Main Content

Specify Map Limits with Geographic Axes

A geographic axes or chart sets the latitude and longitude limits of the basemap to encompass all the points in your data. These map limits do not change when you resize the chart by resizing the figure window except to adapt to changes in the axes or chart aspect. The map limits do change when you zoom in or out or pan. The geographic axes and charts support properties related to map limits. Some are read-only properties that are for informational use.

  • LatitudeLimits - Returns the current latitude limits (read-only).

  • LongitudeLimits - Returns the current longitude limits (read-only).

  • MapCenter - Return or set the current map center point.

  • ZoomLevel - Return or set the current map zoom level.

A convenient way to get the current latitude and longitude limits is to call the geolimits function. You can also use the geolimits function to set the latitude and longitude limits. Use the geolimits function when you want to create a geographic axes or chart with the same map limits as an existing axes or chart. Retrieve the limits of the existing axes or chart and use geolimits to set the limits of the new axes or chart.

Note

You can specify latitudes outside the approximate limits [-85 85], beyond which the basemap tiles do not extend. However these values typically are not visible unless you control the map extent using the MapCenter and ZoomLevel properties. Also, data points very close to 90 degrees and -90 degrees can never be seen, because they map to infinite or near-infinite values in the vertical direction.

Display Several Geographic Bubble Charts Centered Within Specified Limits

This example shows how to create two geographic bubble charts with the same map limits.

Read Lyme Disease sample data into the workspace.

counties = readtable('counties.xlsx');

Create a geographic bubble chart that plots the occurrences of Lyme disease in New England counties.

gb = geobubble(counties,'Latitude','Longitude','SizeVariable','Cases2010');

Pan and zoom the map until you see only the states in northern New England: Vermont, New Hampshire, and Maine.

Get the new limits of the map using the command [nlat nlon] = geolimits(gb). Get the new zoom level as well using the command nzoom = gb.ZoomLevel. Store the latitude, longitude, and zoom level of the new map limits.

nlat = [42.5577   46.6921];
nlon = [-73.5500  -66.8900];
nzoom = 6.3747;

Create another map with Lyme disease occurrence data for 2011 and set the map limits and zoom level to match the first chart.

figure
gb2 = geobubble(counties,'Latitude','Longitude','SizeVariable','Cases2011');
[n2lat n2lon] = geolimits(gb2,nlat,nlon);
gb2.ZoomLevel = nzoom;

See Also

| | | | | | | |

Related Topics