Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cab5dcc commit 03b3314Copy full SHA for 03b3314
lib/matplotlib/tests/test_colorbar.py
@@ -538,17 +538,9 @@ def test_colorbar_inverted_ticks():
538
def test_extend_colorbar_customnorm():
539
# This was a funny error with TwoSlopeNorm, maybe with other norms,
540
# 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')
+ fig, (ax0, ax1) = plt.subplots(2, 1)
+ pcm = ax0.pcolormesh([[0]], norm=TwoSlopeNorm(vcenter=0., vmin=-2, vmax=1))
+ cb = fig.colorbar(pcm, ax=ax0, extend='both')
552
np.testing.assert_allclose(cb.ax.get_position().extents,
553
[0.78375, 0.536364, 0.796147, 0.9], rtol=1e-3)
554
0 commit comments