geolimits

Set or query geographic limits

Description

example

geolimits(latlim,lonlim) adjusts the geographic limits of the current geographic axes or chart to include latitudes ranging from latlim(1) to latlim(2) and longitudes from lonlim(1) to lonlim(2). If there is no current geographic axes or chart, geolimits constructs a default GeographicAxes object and sets its limits.

example

[latitudeLimits,longitudeLimits] = geolimits returns the latitude limits and longitude limits of the current geographic axes or chart.

geolimits('auto') lets the geographic axes or chart choose its geographic limits based on its data locations.

geolimits('manual') requests that the axes or chart preserve its current limits as closely as possible when the map is resized or when its data locations change.

[latitudeLimits,longitudeLimits] = geolimits(___) adjusts the geographic limits and returns the actual limits of the map.

Note

Typically, the actual limits chosen by geolimits are greater in extent than the requested limits because geolimits manages the limits to maintain a correct north-south/east-west aspect.

___ = geolimits(gx,___) operates on the geographic axes or chart specified by gx.

Examples

collapse all

Read tsunami data from a spreadsheet into a table.

tsunamis = readtable('tsunamis.xlsx');

Get the latitude and longitude data from the table. This data specifies the locations of the tsunamis. In addition, get data about the size of each tsunami from the table.

lat = tsunamis.Latitude;
lon = tsunamis.Longitude;
sizedata = tsunamis.MaxHeight;

Create a geographic bubble chart with the tsunami data. Set the title of the size legend by specifying SizeLegendTitle.

gb = geobubble(lat,lon,sizedata,'SizeLegendTitle','Maximum Height');

Get the current geographic limits of the chart. By default, geobubble sets the map limits large enough to encompass all the locations in the data.

[latlim, lonlim] = geolimits
latlim = 1×2

  -79.8575   85.0511

lonlim = 1×2

 -295.8338   37.8078

Modify the geographic limits to get a closer look at tsunami activity in Alaska. The example also specifies a title for the geographic bubble chart.

geolimits([50 65],[-175 -130])
gb.Title = 'Tsunamis in Alaska'

gb = 
  GeographicBubbleChart with properties:

          Basemap: []
        MapLayout: 'normal'
     LatitudeData: [162×1 double]
    LongitudeData: [162×1 double]
         SizeData: [162×1 double]
        ColorData: []

  Show all properties

Get the actual geographic limits used by the chart. Due to zoom level quantization and aspect ratio preservation, the actual limits may differ from the requested limits.

[latlim, lonlim] = geolimits
latlim = 1×2

   45.0809   67.9103

lonlim = 1×2

 -175.0000 -130.0000

Input Arguments

collapse all

Limits of the geographic axes or chart in latitude, specified as a two-element vector.

Example: [50 65]

Data Types: single | double

Limits of the geographic axes or chart in longitude, specified as a two-element vector.

Example: [-175 -130]

Data Types: single | double

Geographic axes or chart, specified as a GeographicAxes object or GeographicBubbleChart object.

Output Arguments

collapse all

Actual latitude limits of map, returned as two-element vector.

Actual longitude limits of map, returned as two-element vector.

Introduced in R2017b