8000 TST: add test for uneven contour colorbar · matplotlib/matplotlib@6d7c885 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d7c885

Browse files
committed
TST: add test for uneven contour colorbar
1 parent 7b3ea96 commit 6d7c885

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Loading

lib/matplotlib/tests/test_contour.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ def test_contourf_log_extension():
403403
cb = plt.colorbar(c2, ax=ax2)
404404
assert cb.ax.get_ylim() == (1e-4, 1e6)
405405
cb = plt.colorbar(c3, ax=ax3)
406-
print(cb.ax.get_ylim())
407406
assert_array_almost_equal(cb.ax.get_ylim(),
408407
[3.162277660168379e-05, 3162277.660168383], 2)
409408

@@ -423,3 +422,16 @@ def test_contour_addlines():
423422
cb = fig.colorbar(pcm)
424423
cb.add_lines(cont)
425424
assert_array_almost_equal(cb.ax.get_ylim(), [114.3091, 9972.30735], 3)
425+
426+
427+
@image_comparison(baseline_images=['contour_uneven'],
428+
extensions=['png'], remove_text=True, style='mpl20')
429+
def test_contour_uneven():
430+
z = np.arange(24).reshape(4, 6)
431+
fig, axs = plt.subplots(1, 2)
432+
ax = axs[0]
433+
cs = ax.contourf(z, levels=[2, 4, 6, 10, 20])
434+
fig.colorbar(cs, ax=ax, spacing='proportional')
435+
ax = axs[1]
436+
cs = ax.contourf(z, levels=[2, 4, 6, 10, 20])
437+
fig.colorbar(cs, ax=ax, spacing='uniform')

0 commit comments

Comments
 (0)
0