Main Content

quiverm

Project 2-D quiver plot on axesm-based map

    Description

    example

    quiverm(lat,lon,dlat,dlon) creates a quiver plot on the current axesm-based map. The quiver plot has arrows with directional components dlat and dlon at the geographic coordinates specified by lat and lon. For example, the first arrow originates from the point lat(1) and lon(1), extends horizontally according to dlon(1), and extends vertically according to dlat(1). By default, the function scales the arrow lengths so that they do not overlap.

    quiverm(lat,lon,dlat,dlon,scale) adjusts the lengths of the arrows:

    • When scale is a positive number, the function automatically adjusts the lengths of arrows so they do not overlap, then stretches them by a factor of scale. For example, a scale of 2 doubles the length of arrows, and a scale of 0.5 halves the length of arrows.

    • When scale is "off" or 0, such as quiverm(lat,lon,dlat,dlon,"off"), the function does not perform automatic scaling.

    quiverm(lat,lon,dlat,dlon,LineSpec) specifies the line style, marker, and color. Markers appear at the points specified by lat and lon. If you specify a marker using LineSpec, the function does not display arrowheads.

    quiverm(lat,lon,dlat,dlon,LineSpec,"filled") fills the markers specified by LineSpec.

    quiverm(lat,lon,dlat,dlon,LineSpec,scale,"filled") adjusts the lengths of the arrows and fills the markers specified by LineSpec.

    h = quiverm(___) returns the quiver plot, using any combination of input arguments from the previous syntaxes.

    Examples

    collapse all

    Load sample data that represents air currents into the workspace, and select a subset of the data.

    load("wind","x","y","u","v")
    lat = y(11:22,11:22,1);
    lon = x(11:22,11:22,1);
    dlat = v(11:22,11:22,1);
    dlon = u(11:22,11:22,1);

    Create a map and display a quiver plot of the subset you selected. The matrices lat and lon represent the location of the base of each arrow, and dlat and dlon represent the directional components of each arrow. By default, the quiverm function shortens the arrows so they do not overlap.

    figure
    [latlim,lonlim] = geoquadline(lat,lon);
    usamap(latlim,lonlim)
    
    quiverm(lat,lon,dlat,dlon)

    Input Arguments

    collapse all

    Latitude coordinates of the bases of the arrows, specified as a scalar, a vector, or a matrix.

    The sizes of lat, lon, dlat, and dlon must match.

    Specify this argument using units that match the AngleUnits property of the axesm-based map.

    Data Types: double

    Longitude coordinates of the bases of the arrows, specified as a scalar, a vector, or a matrix.

    The sizes of lat, lon, dlat, and dlon must match.

    Specify this argument using units that match the AngleUnits property of the axesm-based map.

    Data Types: double

    Latitude components of the arrows, specified as a scalar, vector, or matrix.

    The sizes of lat, lon, dlat, and dlon must match.

    Specify this argument using units that match the AngleUnits property of the axesm-based map.

    Data Types: single | double

    Longitude components of the arrows, specified as a scalar, vector, or matrix.

    The sizes of lat, lon, dlat, and dlon must match.

    Specify this argument using units that match the AngleUnits property of the axesm-based map.

    Data Types: single | double

    Line style, marker, and color, specified as a character vector or string scalar containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color).

    If you specify a marker using LineSpec, then the quiverm function does not display arrowheads.

    Example: "--or" is a red dashed line with circle markers

    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

    MarkerDescriptionResulting Marker
    "o"Circle

    Sample of circle marker

    "+"Plus sign

    Sample of plus sign marker

    "*"Asterisk

    Sample of asterisk marker

    "."Point

    Sample of point marker

    "x"Cross

    Sample of cross marker

    "_"Horizontal line

    Sample of horizontal line marker

    "|"Vertical line

    Sample of vertical line marker

    "square"Square

    Sample of square marker

    "diamond"Diamond

    Sample of diamond marker

    "^"Upward-pointing triangle

    Sample of upward-pointing triangle marker

    "v"Downward-pointing triangle

    Sample of downward-pointing triangle marker

    ">"Right-pointing triangle

    Sample of right-pointing triangle marker

    "<"Left-pointing triangle

    Sample of left-pointing triangle marker

    "pentagram"Pentagram

    Sample of pentagram marker

    "hexagram"Hexagram

    Sample of hexagram marker

    Color NameShort NameRGB TripletAppearance
    "red""r"[1 0 0]

    Sample of the color red

    "green""g"[0 1 0]

    Sample of the color green

    "blue""b"[0 0 1]

    Sample of the color blue

    "cyan" "c"[0 1 1]

    Sample of the color cyan

    "magenta""m"[1 0 1]

    Sample of the color magenta

    "yellow""y"[1 1 0]

    Sample of the color yellow

    "black""k"[0 0 0]

    Sample of the color black

    "white""w"[1 1 1]

    Sample of the color white

    Arrow scaling factor, specified as a nonnegative scalar or "off". By default, the quiverm function automatically scales the arrows so they do not overlap. The quiverm function applies the specified scaling factor after it automatically scales the arrows.

    To turn off automatic scaling, specify scale as "off" or 0. When you specify either of these values, the function plots the arrows from (lat, lon) to (lat+dlat, lon+dlon).

    Output Arguments

    collapse all

    Quiver plot, returned as a vector of Line objects.

    Version History

    Introduced before R2006a

    See Also

    Functions