Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b56d4c9

Browse filesBrowse files
committed
TST: Adding figure comparison test for norm updates
Make sure that updating a norm after a draw has been called will still propagate up the draw tree and update the final saved figure.
1 parent 17b9000 commit b56d4c9
Copy full SHA for b56d4c9

File tree

Expand file treeCollapse file tree

1 file changed

+18
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-1
lines changed

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+18-1Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import matplotlib.cbook as cbook
1818
import matplotlib.pyplot as plt
1919
import matplotlib.scale as mscale
20-
from matplotlib.testing.decorators import image_comparison
20+
from matplotlib.testing.decorators import image_comparison, check_figures_equal
2121

2222

2323
@pytest.mark.parametrize('N, result', [
@@ -1462,3 +1462,20 @@ def test_scalarmappable_norm_update():
14621462
sm.stale = False
14631463
norm.vcenter = 1
14641464
assert sm.stale
1465+
1466+
1467+
@check_figures_equal()
1468+
def test_norm_update_figs(fig_test, fig_ref):
1469+
ax_ref = fig_ref.add_subplot()
1470+
ax_test = fig_test.add_subplot()
1471+
1472+
z = np.arange(100).reshape((10, 10))
1473+
ax_ref.imshow(z, norm=mcolors.Normalize(10, 90))
1474+
1475+
# Create the norm beforehand with different limits and then update
1476+
# after adding to the plot
1477+
norm = mcolors.Normalize(0, 1)
1478+
ax_test.imshow(z, norm=norm)
1479+
# Force initial draw to make sure it isn't already stale
1480+
fig_test.canvas.draw()
1481+
norm.vmin, norm.vmax = 10, 90

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.