-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Milestone
Description
Bug report
Bug summary
Regardless of an AxesImage clip_box property value, they are always additionally clipped to their parent Axes' bbox, unlike other artists (e.g. Line2D) who can have a clip_box completely independent of their parent axes.
Code for reproduction
from matplotlib import pyplot as plt
fig, axs = plt.subplots(2, 2)
l, = axs[0, 1].plot([0, 1])
l.set_clip_box(axs[0, 0].bbox)
im = axs[1, 1].imshow([[0, 1], [2, 3]], aspect="auto", extent=(0, 1, 0, 1))
im.set_clip_path(None)
im.set_clip_box(axs[1, 0].bbox)
plt.show()
Actual outcome
The line in axs[0, 1]
can be seen in axs[0, 0]
by panning axs[0, 1]
to the side.
The image in axs[1, 1]
cannot be seen in axs[1, 0]
(or anywhere else, for that matter) by panning.
Expected outcome
im
is correctly clipped to axs[1, 0]
.
This is likely due to the implementation of AxesImage.make_image
def make_image(self, renderer, magnification=1.0, unsampled=False):
# docstring inherited
trans = self.get_transform()
# image is created in the canvas coordinate.
x1, x2, y1, y2 = self.get_extent()
bbox = Bbox(np.array([[x1, y1], [x2, y2]]))
transformed_bbox = TransformedBbox(bbox, trans)
return self._make_image(
self._A, bbox, transformed_bbox, self.axes.bbox, magnification,
unsampled=unsampled)
(passing self.axes.bbox
as clipping bbox to self._make_image is the problem).
Matplotlib version
- Operating system: linux
- Matplotlib version: master
- Matplotlib backend (
print(matplotlib.get_backend())
): qt5agg - Python version: 37
- Jupyter version (if applicable): none
- Other libraries: