Main Content

scatterm

Project scatter plot on axesm-based map

    Description

    scatterm(lat,lon) creates a scatter plot on the current axesm-based map with circular markers at the geographic locations specified by lat and lon.

    To display scatter plots on geographic axes or map axes, use the geoscatter function instead.

    scatterm(lat,lon,sz) specifies the circle sizes.

    scatterm(lat,lon,sz,c) specifies the circle colors.

    scatterm(___,"filled") fills in the circles, in addition to any of the input argument combinations in the previous syntaxes.

    example

    scatterm(___,mkr) specifies the marker type.

    scatterm(abm,___) plots into the specified axesm-based map abm instead of into the current axesm-based map. The option abm must precede any of the input argument combinations in the previous syntaxes.

    h = scatterm(___) returns the scatter plot.

    Examples

    collapse all

    Create a map of Europe.

    load coastlines
    worldmap europe
    geoshow(coastlat,coastlon,"DisplayType","polygon", ...
        "FaceColor",[0.7 0.9 0.5])

    Project the locations of European capitals onto the map using filled, black markers.

    [lat,lon] = readvars("european_capitals.txt");
    scatterm(lat,lon,"filled","k")

    Figure contains an axes object. The hidden axes object contains 14 objects of type scatter, patch, line, text.

    Create a map for a region containing Southeast Asia.

    load coastlines
    worldmap([-25 35],[90 170])
    geoshow(coastlat,coastlon,"DisplayType","polygon", ...
        "FaceColor",[0.9 1 0.9])

    Project the locations of tsunami events onto the map using filled markers. Specify the marker sizes using the maximum heights of the tsunamis.

    GT = readgeotable("tsunamis.shp","CoordinateSystemType","geographic");
    lat = GT.Shape.Latitude;
    lon = GT.Shape.Longitude;
    h = GT.Max_Height;
    
    scatterm(lat,lon,10*h,"filled")

    Figure contains an axes object. The hidden axes object contains 12 objects of type scatter, patch, line, text.

    Input Arguments

    collapse all

    Latitude coordinates, specified as a scalar or vector. The size of lat must match the size of lon.

    Data Types: single | double

    Longitude coordinates, specified as a scalar or vector. The size of lon must match the size of lat.

    Data Types: single | double

    Marker size, specified as one of these options. The size controls the area of each marker in points squared.

    • A numeric scalar — Use a uniform marker size.

    • A numeric vector — Use a different marker size for each data point. The vector must be the same length as lat and lon.

    • Empty brackets ([]) — Use the default market size of 36 points squared. Use this option when you want to specify c and use the default marker size.

    Marker color, specified as one of these options.

    • RGB triplet or color name — Plot all markers with the same color.

    • Three-column matrix of RGB triplets — Use different colors for each marker. Each row of the matrix specifies an RGB triplet color for the corresponding marker. The number of rows must equal the lengths of lat and lon.

    • Vector — Use different colors for each marker and linearly map values in c to the current colormap. The length of c must equal the length of lat and lon.

    An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7]. Alternatively, you can specify some common colors by name. This table lists the named color options and equivalent RGB triplets.

    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

    Option to fill the interior of the markers, specified as "filled". Use this option with markers that have a face, such as "o" or "square". When you use this option with markers that do not have a face, such as "+", "*", ".", and "x", the function does not display any markers.

    Marker symbol, specified as one of the values listed in this table.

    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

    axesm-based map, specified as a map created using the axesm, worldmap, or usamap function.

    Output Arguments

    collapse all

    Scatter plot, returned as a Group object.

    Version History

    Introduced before R2006a

    See Also

    Functions