Project geolocated data grid on map axes
h = surfm(...)
surfm(lat,lon,Z) constructs a surface to represent the data grid Z in the current map axes. The surface lies flat in the horizontal plane with its CData property set to Z. The 2-D arrays or vectors lat and lon define the latitude-longitude graticule mesh on which Z is displayed. The sizes and shapes of lat and lon affect their interpretation, and also determine whether the default FaceColor property of the surface is 'flat' or 'texturemap'. There are three options:
2-D arrays (matrices) having the same size as Z. Lat and lon are treated as geolocation arrays specifying the precise location of each vertex. FaceColor is 'flat'.
2-D arrays having a different size than Z. The arrays lat and lon define a graticule mesh that might be either larger or smaller than Z. Lat and lon must match each other in size. FaceColor is 'texturemap'.
Vectors having more than two elements. The elements of lat and lon are repeated to form a graticule mesh with size equal to numel(lat)-by-numel(lon). FaceColor is 'flat' if the graticule mesh matches Z in size. Otherwise, FaceColor is 'texturemap'.
surfm clears the current map if the hold state is 'off'.
surfm(latlim,lonlim,Z) defines the graticule using the latitude and longitude limits latlim and lonlim, which should match the geographic extent of the data grid Z. Latlim is a two-element vector of the form:
Likewise lonlim has the form:
A latitude-longitude graticule is constructed to match Z in size. The surface FaceColor property is 'flat' by default.
surfm(lat,lon,Z,alt) sets the ZData property of the surface to 'alt', resulting in a 3-D surface. lat and lon must result in a graticule mesh that matches alt in size. CData is set to Z. The FaceColor property is 'texturemap', unless Z matches alt in size, in which case it is 'flat'.
surfm(...,prop1,val1,prop2,val2,...) applies additional MATLAB® graphics properties to the surface via property/value pairs. You can specify any property accepted by the surface function except XData, YData, and ZData.
Construct a surface to represent the data grid topo.
figure('Color','white') load topo axesm miller axis off; framem on; gridm on; [lat,lon] = meshgrat(topo,topolegend,[90 180]); surfm(lat,lon,topo) demcmap(topo)
This function warps a data grid to a graticule mesh, which is projected according to the map axes property MapProjection. The fineness, or resolution, of this grid determines the quality of the projection and the speed of plotting it. There is no hard and fast rule for sufficient graticule resolution, but in general, cylindrical projections need very few graticule points in the longitudinal direction, while complex curve-generating projections require more.