geoaxes

Create geographic axes

Description

example

geoaxes creates a geographic axes in the current figure using default property values, and makes it the current axes.

A geographic axes displays data in geographic coordinates (latitude/longitude) on a map. The map is live, that is, you can pan to view other geographic locations and zoom in and out on the map to view regions in more detail.

geoaxes(Name,Value) specifies values for properties of the GeographicAxes object using one or more name-value pair arguments.

geoaxes(parent,___) creates the geographic axes in the figure, panel, or tab specified by parent, instead of in the current figure.

gx = geoaxes(___) returns the GeographicAxes object. Use gx to modify properties of the axes after you create it.

geoaxes(gx) makes the GeographicAxes object gx the current axes.

Examples

collapse all

Create a set of geographic axes.

gx = geoaxes;

Plot data using the geoplot function. To modify the geographic axes you created, specify gx as an input argument. Customize the appearance of the line using the line specification 'g-*'. Change the basemap using the geobasemap function.

latSeattle = 47.62;
lonSeattle = -122.33;
latAnchorage = 61.20;
lonAnchorage = -149.9;
geoplot(gx,[latSeattle latAnchorage],[lonSeattle lonAnchorage],'g-*')
geobasemap(gx,'colorterrain')

Input Arguments

collapse all

Parent container, specified as a Figure, Panel, Tab, or TiledChartLayout object.

Geographic axes to be made current axes, specified as a GeographicAxes object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: gx = geoaxes('Basemap','colorterrain')

The properties listed here are only a subset. For a complete list, see GeographicAxes Properties.

Map on which to plot data, specified as one of the values listed in the table. Six of the basemaps are tiled data sets that MathWorks® derives from public-domain data. Five of the basemaps are high-zoom-level maps hosted by Esri®.

MATLAB® includes one installed basemap, a two-tone map named 'darkwater'. Use of this basemap does not require Internet access. Use of the other basemaps, including the default basemap 'streets-light', does require Internet access.

If you do not have consistent access to the Internet, you can download the basemaps hosted by MathWorks onto your local system by using the Add-On Explorer. The five high-zoom-level maps are not available for download. For more about downloading basemaps and changing the default basemap on your local system, see Access Basemaps in MATLAB.

The five basemaps hosted by Esri include attributions that give credit to the provider of the map data. This attribution can change as you zoom in on a map because different organizations contribute map data at different zoom levels for different localities. Alignment of boundaries and region labels are a presentation of the feature provided by our data vendors and does not imply endorsement by MathWorks.

'streets-light'

Map designed to provide geographic context while highlighting user data on a light background.

Hosted by Esri.

'satellite'

Full global basemap composed of high-resolution satellite imagery.

Hosted by Esri.

'streets-dark'

Map designed to provide geographic context while highlighting user data on a dark background.

Hosted by Esri.

'topographic'

General-purpose map with styling to depict topographic features.

Hosted by Esri.

'streets'

General-purpose road map that emphasizes accurate, legible styling of roads and transit networks.

Hosted by Esri.

'landcover'

Map that combines satellite-derived land cover data, shaded relief, and ocean-bottom relief. The light, natural palette is suitable for thematic and reference maps.

Provided by MathWorks.

'grayterrain'

Terrain map in shades of gray. Shaded relief emphasizes both high mountains and micro-terrain found in lowlands.

Provided by MathWorks.

'colorterrain'

Shaded relief map blended with a land cover palette. Humid lowlands are green and arid lowlands are brown.

Provided by MathWorks.

'grayland'

Two-tone, land-ocean map with gray land areas and white water areas.

Provided by MathWorks.

'bluegreen'

Two-tone, land-ocean map with light green land areas and light blue water areas.

Provided by MathWorks.

'darkwater'

Two-tone, land-ocean map with light gray land areas and dark gray water areas. This basemap is installed with MATLAB.

Provided by MathWorks.

 

'none'

Blank background that plots your data with a latitude-longitude grid, ticks, and labels.

Example: gx = geoaxes('Basemap','bluegreen')

Example: gx.Basemap = 'bluegreen'

Data Types: char | string

Size and location, excluding margin for labels, specified as a four-element vector of the form [left bottom width height]. For more information, see Control Axes Layout.

Position units, specified as one of these values.

UnitsDescription
'normalized' (default)Normalized with respect to the container, which is typically the figure or a panel. The lower left corner of the container maps to (0,0), and the upper right corner maps to (1,1).
'inches'Inches
'centimeters'Centimeters
'characters'

Based on the default uicontrol font of the graphics root object:

  • Character width = width of letter x.

  • Character height = distance between the baselines of two lines of text.

'points'Typography points. One point equals 1/72 inch.
'pixels'

Pixels.

Starting in R2015b, distances in pixels are independent of your system resolution on Windows® and Macintosh systems:

  • On Windows systems, a pixel is 1/96th of an inch.

  • On Macintosh systems, a pixel is 1/72nd of an inch.

On Linux® systems, the size of a pixel is determined by your system resolution.

When specifying the units as a name-value pair during object creation, you must set the Units property before specifying the properties that you want to use these units, such as OuterPosition.

Output Arguments

collapse all

Geographic axes, returned as a GeographicAxes object.

Tips

  • If you have Mapping Toolbox™, you can specify basemaps of your own choosing by using the addCustomBasemap function.

  • Some graphics functions reset axes properties when plotting. To plot additional data in a geographic axes, use the hold on command before calls to plotting functions.

  • You cannot plot data that requires Cartesian axes in a geographic chart.

Introduced in R2018b