Axes control for geoscatter, set the lat and lon limits and remove unwanted, repeated map geography

45 visualizzazioni (ultimi 30 giorni)
I am producing a series of map figures showing changing latitude and longitude data throughout the day. I want to set the latitude and longitude limits and keep them the same for all plots, though data may only cover a portion of the map. I am using geoscatter and geolimits, but when I set the limits, excess map area shows outside the map, mainly along the longitude axis and it is a repeat of area already shown. There is no data plotted in the excess, repeated area. These are the basic commands I'm using and a screen shot.
scatFig = geoscatter(latitudeData, longitudeData, 1, scatterData);
set(gca, 'colorscale', 'log');
colormap(jet(10));
geolimits([-70 90], [-179 179])
The plot below shows the axes limits set as I require, but the excess map below 70S and beyond 180E/180W is causing the map itself to contract, reducing the data visibility. I would like to remove the antarctic excess and the repeat of Alaska and eastern Russia. -Thanks

Risposta accettata

Rob Comer
Rob Comer il 29 Ott 2021
In your call to geolimits, you specifed latitude limits that extend all the way to the North Pole:
geolimits([-70 90], [-179 179])
However, geoscatter creates a GeographicAxes (geoaxes), which is unsuitable for displaying data north of about 85 degees. That's because it uses a Web Mercator projection in which 90 N maps to +inf in y (and 90 S maps to -inf). For the same reason, there are no basemap tiles for the polar regions ([85 90] and [-90 -85]). There's also some automatic padding of the longitude limits to ensure that the map (both your data and the underlying basemap) continues to fill the axes position in the figure without introducing shape distortions.
If you don't need to map data north of +85, then from what I can see the following limits could work for you:
geolimits([-70 85], [-180 180])
If you want, you can check the actual limits like this:
>> [latlim, lonlim] = geolimits
latlim =
-71.6681 85.0511
lonlim =
-180 180
You can see that there's still a small amount of padding applied, this time in latitude rather than longitude, but it's scarcely noticeable.
If you do need to plot data north of +85, consider using Mapping Toolbox functions such as worldmap, geoshow, and scatterm, which will allow you to plot your data in a more suitable projection.
  1 Commento
Mike Susedik
Mike Susedik il 29 Ott 2021
Thanks for the explanation, it was very informative. I've worked with those other plots and ran into troubles, but I'll revisit. With the changes the longitude seems better behaved too.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Geographic Plots in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by