Main Content

pcolorm

Project geolocated data grid in h = 0 plane on axesm-based map

    Description

    pcolorm(lat,lon,Z) displays a surface on the current axesm-based map by warping the geolocated data grid Z, with geographic coordinates lat and lon, to a projected graticule mesh. The color of the surface varies according to the values in Z. This function displays the surface in a horizontal plane with all height values set to 0.

    example

    pcolorm(latlim,lonlim,Z) creates a graticule mesh using the latitude limits latlim and the longitude limits lonlim.

    pcolorm(___,Name,Value) specifies surface properties using one or more name-value pair arguments. For example, "FaceAlpha",0.5 creates a semitransparent plot.

    example

    s = pcolorm(___) returns the primitive surface object. Use s to modify the plot after creation. For a list of properties, see Surface Properties.

    Examples

    collapse all

    Load elevation data and a geographic cells reference object for the Korean peninsula. Extract the latitude and longitude coordinates from the reference object.

    load topo60c
    [topo60c,topo60cR] = geocrop(topo60c,topo60cR,[-90 90],[-180 180]);
    [lat,lon] = geographicGrid(topo60cR);

    Find the latitude and longitude limits of the data. Then, display the data on a world map using a colormap appropriate for elevation data.

    [latlim,lonlim] = geoquadline(lat,lon);
    worldmap world
    pcolorm(latlim,lonlim,topo60c)
    demcmap(topo60c)

    Figure contains an axes object. The hidden axes object contains 18 objects of type patch, surface, line, text.

    Load elevation data and a geographic cells reference object for the Korean peninsula. Extract the latitudes and longitudes from the reference object.

    load korea5c
    [lat,lon] = geographicGrid(korea5cR);

    Find the latitude and longitude limits of the data. Then, display the data on a world map. Adjust the transparency of the surface plot using the FaceAlpha name-value argument.

    [latlim,lonlim] = geoquadline(lat,lon);
    worldmap(latlim,lonlim)
    pcolorm(lat,lon,korea5c,"FaceAlpha",0.5)

    Apply a colormap appropriate for elevation data.

    demcmap(korea5c)

    Figure contains an axes object. The hidden axes object contains 9 objects of type patch, surface, line, text.

    Input Arguments

    collapse all

    Latitude coordinates, specified as a vector or a matrix. The sizes of lat and lon must match.

    • When lat and lon are matrices of the same size as Z, the pcolorm function displays each element of Z at the location specified by the corresponding elements of lat and lon.

    • When lat and lon are matrices of a different size than Z, the pcolorm function creates a graticule mesh of the same size as lat.

    • When lat and lon are vectors, the pcolorm function creates a graticule mesh of size length(lat)-by-length(lon) by replicating lat and lon.

    Data Types: double

    Longitude coordinates, specified as a vector or a matrix. The sizes of lon and lat must match.

    • When lat and lon are matrices of the same size as Z, the pcolorm function displays each element of Z at the location specified by the corresponding elements of lat and lon.

    • When lat and lon are matrices of a different size than Z, the pcolorm function creates a graticule mesh of the same size as lat.

    • When lat and lon are vectors, the pcolorm function creates a graticule mesh of size length(lat)-by-length(lon) by replicating lat and lon.

    Data Types: double

    Geolocated data grid, specified as an m-by-n array.

    Latitude limits for Z, specified as a two-element vector.

    The pcolorm function uses latlim and lonlim to create a graticule mesh of size 50-by-100.

    Data Types: double

    Latitude limits for Z, specified as a two-element vector.

    The pcolorm function uses latlim and lonlim to create a graticule mesh of size 50-by-100.

    Data Types: double

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: pcolorm(lat,lon,Z,LineStyle="-") displays the graticule mesh using a solid line.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: pcolorm(lat,lon,Z,"LineStyle","-") displays the graticule mesh using a solid line.

    Note

    Use name-value arguments to specify values for the properties of the Surface object created by this function. The properties listed here are only a subset. For a full list, see Surface Properties.

    Surface objects created by the pcolorm function have these limitations:

    • Setting the XData, YData, and ZData properties of the surface object is not supported.

    • If you set the UserData property of the surface and then change the projection of the axesm-based map, MATLAB® does not reproject the surface.

    Line style, specified as one of the options listed in this table.

    Line StyleDescriptionResulting Line
    "-"Solid line

    Sample of solid line

    "--"Dashed line

    Sample of dashed line

    ":"Dotted line

    Sample of dotted line

    "-."Dash-dotted line

    Sample of dash-dotted line, with alternating dashes and dots

    "none"No lineNo line

    Line width, specified as a positive value in points, where 1 point = 1/72 of an inch. If the line has markers, then the line width also affects the marker edges.

    The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.

    Output Arguments

    collapse all

    Primitive surface object, returned as a Surface object. Use s to modify the Surface object after creation. For a list of properties, see Surface Properties.

    Surface objects created by the pcolorm function have these limitations:

    • Setting the XData, YData, and ZData properties of the surface object is not supported.

    • If you set the UserData property of the surface and then change the projection of the axesm-based map, MATLAB does not reproject the surface.

    Tips

    • The FaceColor property of the surface object depends on the size of the graticule mesh. The pcolorm function sets FaceColor to "flat" when the size of the graticule mesh matches the size of Z, and "texturemap" otherwise.

    • The pcolorm function projects the graticule mesh using the projection specified by the MapProjection property of the axesm-based map. To improve the resolution of the plot, increase the size of the graticule mesh. Increasing the size of the graticule mesh can increase the amount of time MATLAB requires to display the surface.

    Version History

    Introduced before R2006a