Improve plot aspect handling when using cartopy
See original GitHub issueThis applies to single plots and FacetGrids.
The current plotting behavior when using a projection that changes the plot aspect is as follows:
from xray.tutorial import load_dataset
ds = load_dataset('air_temperature')
ax = plt.subplot(projection=ccrs.LambertConformal())
ds.air.isel(time=0).plot(transform=ccrs.PlateCarree())
ax.coastlines()
ax.gridlines()
fg = ds.air.isel(time=slice(0, 9)).plot(col='time', col_wrap=3, transform=ccrs.PlateCarree(),
subplot_kws=dict(projection=ccrs.LambertConformal()))
for ax in fg.axes.flat:
ax.coastlines()
ax.gridlines()
There are two problems here, I think both are related to the aspect of the subplot:
- In the single case, the subplot aspect is correct but the colorbar is not scaled appropriately
- In the FacetGrid case, the subplot aspects are not correct but the colorbar is.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
More advanced mapping with cartopy and matplotlib - SciTools
From the outset, cartopy's purpose has been to simplify and improve the quality of mapping visualisations available for scientific data. Thanks to the ......
Read more >How can I modify the margins when I plot map with cartopy?
This will create an axes which sits tight at one side of the figure. The reason is that the map has a fixed...
Read more >Making Maps with Cartopy — COSIMA Recipes documentation
This tutorial focusses on mapping with Cartopy . ... Instead, let's plot the same data with cartopy. ... You can see that this...
Read more >Interpolations for imshow — Matplotlib 3.6.2 documentation
For the Agg, ps and pdf backends, interpolation='none' works well when a big image is scaled down, while interpolation='nearest' works well when a...
Read more >Working with Maps - Python Numerical Methods
cartopy has very nice API to interact with matplotlib, to plot a map, we only need to tell the matplotlib to use a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a solution for 1. This function works really well even when resizing a figure on matplotlib 3.0.2:
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here or remove the
stale
label; otherwise it will be marked as closed automatically