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

Skip to content

Commit dfbbcfc

Browse files
committed
TST: add a test for re-scale and re-lim
1 parent f54acfd commit dfbbcfc

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def _set_ticks_on_axis_warn(*args, **kw):
227227
class ColorbarAxes(Axes):
228228
"""
229229
Colorbar Axes are actually two axes, a parent axes that takes care of
230-
positioning the axes and an inset_axes that takes care of the drawing,
230+
positioning the axes, and an inset_axes that takes care of the drawing,
231231
labels, ticks, etc. The inset axes is used as a way to properly
232232
position the triangles (or rectangles) that are used to indicate
233233
over/under colors.

lib/matplotlib/tests/test_colorbar.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,3 +709,16 @@ def test_anchored_cbar_position_using_specgrid():
709709
np.testing.assert_allclose(
710710
[cx1, cx0],
711711
[x1 * shrink + (1 - shrink) * p0, p0 * (1 - shrink) + x0 * shrink])
712+
713+
714+
@image_comparison(['colorbar_change_lim_scale.png'], remove_text=True,
715+
style='mpl20')
716+
def test_colorbar_change_lim_scale():
717+
fig, ax = plt.subplots(1, 2, constrained_layout=True)
718+
pc = ax[0].pcolormesh(np.arange(100).reshape(10, 10)+1)
719+
cb = fig.colorbar(pc, ax=ax[0], extend='both')
720+
cb.ax.set_yscale('log')
721+
722+
pc = ax[1].pcolormesh(np.arange(100).reshape(10, 10)+1)
723+
cb = fig.colorbar(pc, ax=ax[1], extend='both')
724+
cb.ax.set_ylim([20, 90])

0 commit comments

Comments
 (0)