GeezerVison is showing github.com — `indicate_inset` transform support by rcomer · Pull Request #29174 · matplotlib/matplotlib
Conversation
rcomer
commented
Nov 22, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
PR summary
- Corrected the
indicate_inset docstring, as we are definitely defaulting to transData.
- Currently the ends of the connectors that meet the box do not use the passed transform. So against
main, my new image test gives

- Set the
axes property on the rectangle so that Cartopy transforms will work, and we can do things like
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
main_map_proj = ccrs.TransverseMercator()
pcarree = ccrs.PlateCarree()
fig, ax = plt.subplots(subplot_kw={"projection": main_map_proj})
ax.set_extent([-50, 15, 50, 70], crs=pcarree)
ax.add_feature(cfeature.OCEAN.with_scale('50m'), facecolor="lightsteelblue", zorder=1,
edgecolor="k", lw=0.2)
inset_ax = ax.inset_axes((0.05, 0.05, 0.3, 0.3), projection=pcarree)
inset_extent = [-44, -38, 63, 66]
inset_ax.set_extent(inset_extent, crs=pcarree)
inset_ax.add_feature(cfeature.OCEAN, facecolor="lightsteelblue", zorder=1)
ax.indicate_inset_zoom(inset_ax, edgecolor="black", transform=pcarree)
x = [inset_extent[0], inset_extent[1], inset_extent[1], inset_extent[0]]
y = [inset_extent[2], inset_extent[2], inset_extent[3], inset_extent[3]]
for a in ax, inset_ax:
a.scatter(x, y, c=range(4), s=150, transform=pcarree)
plt.show()

PR checklist
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
|
|
|
@image_comparison(['zoom_inset_transform.png'], remove_text=True, style='mpl20',
|
|
|
tol=0.01)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MacOS tests need the 0.01 tolerance.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
# Set axes on the rectangle (required for some external transforms to work) as
|
|
|
# well as the InsetIndicator artist.
|
|
|
self.rectangle.axes = new_axes
|
|
|
artist.Artist.axes.fset(self, new_axes)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
QuLogic
QuLogic approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|