| Mapping Toolbox | ![]() |
Construct a map graticule mesh for surface object display
Syntax
[latgrat,longrat] = meshgrat(map,refvec) constructs a graticule for the regular data grid map with the associated referencing vector refvec. The default graticule size is equal to the size of the map matrix.
[latgrat,longrat] = meshgrat(map,refvec,npts) returns a graticule mesh of size npts. The input npts is a two-element vector of the form [latitude-points longitude-points]. If npts is set to an empty matrix, then the graticule returned is the Mapping Toolbox default graticule size [50 100].
[latgrat,longrat] = meshgrat(lat,lon) can be used for data grids that are not regular in spacing (e.g., row one represents 1º, row two represents 1.34º) but are regular in orientation (rows are north-south, columns are east-west). The inputs lat and lon are vectors describing the latitudes and longitudes on a row-by-row and column-by-column basis for the data grid to be displayed. Regardless of the variable spacing of the matrix, the graticule is evenly spaced. In this form, meshgrat is similar to the MATLAB function meshgrid.
[latgrat,longrat] = meshgrat(latlim,lonlim,npts) returns a graticule mesh of size npts. The input vectors latlim and lonlim are two-element vectors specifying the graticule latitude and longitude limits. The input npts is a two-element vector of the form [latitude-points longitude-points]. If npts is set to an empty matrix, then the graticule returned is the Mapping Toolbox default graticule size [50 100].
[latgrat,longrat] = meshgrat(lat,lon,units) and [latgrat,longrat] = meshgrat(latlim,lonlim,npts,units) use the input units to specify the angle units of the input and output parameters. If omitted, 'degrees' is assumed.
Description
The graticule mesh is a grid of points that are projected on a map axes and to which surface map objects are warped. The fineness, or resolution, of this grid determines the quality of the projection and the speed of plotting. There is no hard and fast rule for sufficient graticule resolution, but in general, cylindrical projections need very few graticules in the longitudinal direction, while complex curve-generating projections require more.
Examples
Make a (coarse) graticule for the entire world:
latlim = [-90 90]; longlim = [-180 180]; [latgrat,longrat] = meshgrat(latlim,longlim,[3 6]) latgrat = -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 0 0 0 0 0 0 90.0000 90.0000 90.0000 90.0000 90.0000 90.0000 longrat = -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000 -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000 -180.0000 -108.0000 -36.0000 36.0000 108.0000 180.0000
These paired coordinates are the graticule vertices, which are projected according to the requirements of the desired map projection. Then a surface object like the topo map can be warped to the grid.
See Also
meshm |
Regular data grid warped to a projected graticule mesh |
pcolorm |
Project a data grid in the z = 0 plane |
surfacem |
Data grid warped to a projected graticule mesh |
surfm |
Data grid projected on a map axes |
| meanm | meshlsrm | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |