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
LongitudeLimits - Returns the current longitude limits
MapCenter - Return or set the current map center
ZoomLevel - Return or set the current map zoom
A convenient way to get the current latitude and longitude limits is to call the
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
to set the limits of the new axes or chart.
You can specify latitudes outside the approximate limits
85], beyond which the basemap tiles do not extend. However these
values typically are not visible unless you control the map extent using the
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.
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.6472 47.0959]; nlon = [-73.6645 -67.3824]; nzoom = 6.2500;
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;