Support inset_axes zooms for all GeoAxes projections
See original GitHub issueDescription
inset_axes
doesn’t work for geographic plots.
Steps to reproduce
import proplot as plot
f, axs = plot.subplots(
ncols=2, axwidth=2.5,
proj='robin', proj_kw={'lon_0': 180}
)
axs.format(
suptitle='Figure with single projection',
coast=True, latlines=30, lonlines=60
)
axi = axs.inset(
[0, 0, 10, 10], transform='data', zoom=True,
zoom_kw={'color': 'red3', 'lw': 2}
)
Error
Traceback (most recent call last):
File "test_del.py", line 16, in <module>
zoom_kw={'color': 'red3', 'lw': 2}
File "/yin_raid/xin/miniconda3/envs/python37/lib/python3.7/site-packages/proplot/subplots.py", line 217, in _iterator
ret.append(func(*args, **kwargs))
File "/yin_raid/xin/miniconda3/envs/python37/lib/python3.7/site-packages/proplot/axes.py", line 1334, in inset_axes
bb = locator(None, None)
File "/yin_raid/xin/miniconda3/envs/python37/lib/python3.7/site-packages/proplot/axes.py", line 348, in inset_locator
bb = mtransforms.TransformedBbox(bbox, trans)
File "/yin_raid/xin/miniconda3/envs/python37/lib/python3.7/site-packages/matplotlib/transforms.py", line 1005, in __init__
raise ValueError("'transform' must be an instance of "
ValueError: 'transform' must be an instance of 'matplotlib.transform.Transform'
Proplot version
0.5.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Trouble using Insetposition for Inset Axes with Cartopy
... #GeoAxes has a width/height ratio according to self's projection ... Do not support a interactive zoom in and out # so plz...
Read more >Zoom region inset axes — Matplotlib 3.6.2 documentation
Example of an inset axes and a rectangle showing where the zoom is located. The use of the following functions, methods, classes and...
Read more >correctly treat pan/zoom events of overlapping axes #22347
you'd need to ensure that the inset-axes has the same projection; you'd have to identify the clicked point in data-coordinates and adjust the...
Read more >Axes — ProPlot documentation
Draw lines indicating the zoom range of the inset axes. ... Basically, any object with a get_cmap method, like the objects returned by...
Read more >Cartopy matplotlib integration reference document - SciTools
Create a GeoAxes object using standard matplotlib Axes args and kwargs. Kwargs: map_projection - The target Projection of. this Axes object. All ......
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
This is actually not an advertised feature but it’s on my to-do list under the category “make
XYAxes
features work with rectangular projections like Mercator and Plate Carrée”. See #131 for details.Will leave this issue open as a feature request for now. As a workaround you can probably make your own inset axes using the default cartopy API with e.g.
This seems to work pretty well for Plate Carree projections in the latest version. Have to set manually set the left/bottom spaces or else the result is wrong… but not too much effort.
Non-Plate Carree are a different story thought. Again matplotlib isn’t supplying the correct bounds:
Since the issue with using the wrong “transform” is fixed I’ll remove the “bug” tag.