Main Content

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, TiledChartLayout, or GridLayout object.

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

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.

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

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 created using Natural Earth. Five of the basemaps are high-zoom-level maps hosted by Esri®.

'streets-light' basemap

'streets-light' (default)

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

Hosted by Esri.

'streets-dark' basemap

'streets-dark'

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

Hosted by Esri.

'streets' basemap

'streets'

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

Hosted by Esri.

'satellite' basemap

'satellite'

Full global basemap composed of high-resolution satellite imagery.

Hosted by Esri.

'topographic' basemap

'topographic'

General-purpose map with styling to depict topographic features.

Hosted by Esri.

'landcover' basemap

'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.

Created using Natural Earth.

'colorterrain' basemap

'colorterrain'

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

Created using Natural Earth.

'grayterrain' basemap

'grayterrain'

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

Created using Natural Earth.

'bluegreen' basemap

'bluegreen'

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

Created using Natural Earth.

'grayland' basemap

'grayland'

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

Created using Natural Earth.

'darkwater' basemap

'darkwater'

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

Created using Natural Earth.

 

'none'

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

All basemaps except 'darkwater' require Internet access. The 'darkwater' basemap is included with MATLAB.

If you do not have consistent access to the Internet, you can download the basemaps created using Natural Earth 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 for Geographic Axes and Charts.

The basemaps hosted by Esri update periodically. As a result, you might see differences in your visualizations over time.

Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.

Example: gb = geobubble(1:10,1:10,'Basemap','bluegreen')

Example: gb.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

  • Specify custom basemaps using the Mapping Toolbox™ function addCustomBasemap (Mapping Toolbox).

  • Add a basemap picker to the axes toolbar by using the Mapping Toolbox function addToolbarMapButton (Mapping Toolbox).

  • Plot 3-D geographic data using the Mapping Toolbox functions geoglobe (Mapping Toolbox) and geoplot3 (Mapping Toolbox).

  • 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.

  • When you plot on geographic axes, the geoaxes function assumes that coordinates are referenced to the WGS84 coordinate reference system. If you plot using coordinates that are referenced to a different coordinate reference system, then the coordinates may appear misaligned.

Version History

Introduced in R2018b