Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62c9efc

Browse files
phobsonOceanWolf
authored andcommitted
attempting to create a baseline image
couldn't actually run the test suite b/c python iesn't installed as a framework.
1 parent 04ea107 commit 62c9efc

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,23 @@ def test_premature_scaling(self):
340340
norm.inverse(np.array([0.1, 0.5, 0.9]))
341341

342342

343+
@image_comparison(baseline_images=['test_offset_norm'], extensions=['png'])
344+
def test_offset_norm_img():
345+
x = np.linspace(-2, 7)
346+
y = np.linspace(-1*np.pi, np.pi)
347+
X, Y = np.meshgrid(x, y)
348+
Z = x * np.sin(Y)**2
349+
350+
fig, (ax1, ax2) = plt.subplots(ncols=2)
351+
cmap = plt.cm.coolwarm
352+
norm = mcolors.OffsetNorm(vmin=-2, vcenter=0, vmax=7)
353+
354+
img1 = ax1.imshow(Z, cmap=cmap, norm=None)
355+
cbar1 = fig.colorbar(img1, ax=ax1)
356+
357+
img2 = ax2.imshow(Z, cmap=cmap, norm=norm)
358+
cbar2 = fig.colorbar(img2, ax=ax2)
359+
343360
def test_SymLogNorm():
344361
"""
345362
Test SymLogNorm behavior

0 commit comments

Comments
 (0)