-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
indicate_inset_zoom not working on some projections #2482
Comments
Matplotlib has two versions of I doubt either way will work with Cartopy transforms but, to understand what needs to be done to make it work, we should start with an example that uses the right pair of functions. I suggest that |
Thanks, unfortunately the version with the right map_proj = ccrs.TransverseMercator(
)
fig, ax = plt.subplots(
figsize=(15, 15),
subplot_kw={
"projection": map_proj
},
)
ax.set_extent([-50, 15, 50, 70], crs=ccrs.PlateCarree())
ax.add_feature(cfeature.OCEAN.with_scale('50m'), facecolor="lightsteelblue", zorder=1)
ax.coastlines(linewidth=0.2, zorder=2)
inset_ax = ax.inset_axes(
(0.05, 0.05, 0.3, 0.3),
projection=map_proj
)
inset_extent = [-44, -38, 63, 66]
inset_ax.set_extent(inset_extent, crs=ccrs.PlateCarree())
inset_ax.add_feature(cfeature.OCEAN, facecolor="lightsteelblue", zorder=1)
x = [inset_extent[0], inset_extent[1], inset_extent[1], inset_extent[0], inset_extent[0]]
y = [inset_extent[2], inset_extent[2], inset_extent[3], inset_extent[3], inset_extent[2]]
ax.plot(x, y, color='k', alpha=0.5, transform=ccrs.PlateCarree())
# # Draw lines between inset map and box on main map
rect, connectors = ax.indicate_inset_zoom(inset_ax, edgecolor="black", alpha=0.5, transform=ax.transAxes) I just tried to remove the the Just for context, I was using this example https://predictablysunny.com/posts/inset_map_cartopy/ which was also using the |
Description
On most non-standard projections (like
TransverseMercator
) the connectors to an inset axis are not drawn correctly.Code to reproduce
produces this
However, for some projections like
Mercator
orPlateCarree
, it worksFull environment definition
Cartopy version
0.24.0
conda list
The text was updated successfully, but these errors were encountered: