8000 Merge pull request #16059 from anntzer/colorbar_test · matplotlib/matplotlib@745dcae · GitHub
[go: up one dir, main page]

Skip to content

Commit 745dcae

Browse files
authored
Merge pull request #16059 from anntzer/colorbar_test
Simplify colorbar test.
2 parents 0daafe5 + 03b3314 commit 745dcae

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/matplotlib/tests/test_colorbar.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -538,17 +538,9 @@ def test_colorbar_inverted_ticks():
538538
def test_extend_colorbar_customnorm():
539539
# This was a funny error with TwoSlopeNorm, maybe with other norms,
540540
# when extend='both'
541-
N = 100
542-
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
543-
Z1 = np.exp(-X**2 - Y**2)
544-
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
545-
Z = (Z1 - Z2) * 2
546-
547-
fig, ax = plt.subplots(2, 1)
548-
pcm = ax[0].pcolormesh(X, Y, Z,
549-
norm=TwoSlopeNorm(vcenter=0., vmin=-2, vmax=1),
550-
cmap='RdBu_r')
551-
cb = fig.colorbar(pcm, ax=ax[0], extend='both')
541+
fig, (ax0, ax1) = plt.subplots(2, 1)
542+
pcm = ax0.pcolormesh([[0]], norm=TwoSlopeNorm(vcenter=0., vmin=-2, vmax=1))
543+
cb = fig.colorbar(pcm, ax=ax0, extend='both')
552544
np.testing.assert_allclose(cb.ax.get_position().extents,
553545
[0.78375, 0.536364, 0.796147, 0.9], rtol=1e-3)
554546

0 commit comments

Comments
 (0)
0