8000 Backport PR #9442: BUG: Fix `_extent` not set in PcolorImage · matplotlib/matplotlib@7dd34d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7dd34d7

Browse files
tacaswellMeeseeksDev[bot]
authored andcommitted
Backport PR #9442: BUG: Fix _extent not set in PcolorImage
1 parent 4ad5179 commit 7dd34d7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5848,6 +5848,7 @@ def pcolorfast(self, *args, **kwargs):
58485848
norm=norm,
58495849
alpha=alpha,
58505850
**kwargs)
5851+
im.set_extent((xl, xr, yb, yt))
58515852
self.add_image(im)
58525853
ret = im
58535854

lib/matplotlib/tests/test_image.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,12 @@ def test_pcolorimage_setdata():
561561
assert im._A[0, 0] == im._Ax[0] == im._Ay[0] == 0, 'value changed'
562562

563563

564+
def test_pcolorimage_extent():
565+
im = plt.hist2d([1, 2, 3], [3, 5, 6],
566+
bins=[[0, 3, 7], [1, 2, 3]])[-1]
567+
assert im.get_extent() == (0, 7, 1, 3)
568+
569+
564570
def test_minimized_rasterized():
565571
# This ensures that the rasterized content in the colorbars is
566572
# only as thick as the colorbar, and doesn't extend to other parts

0 commit comments

Comments
 (0)
0