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

Skip to content

Commit 5d38073

Browse files
committed
TST: add test
1 parent a92bf03 commit 5d38073

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_colorbar.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,3 +979,15 @@ def test_colorbar_set_formatter_locator():
979979
fmt = LogFormatter()
980980
cb.minorformatter = fmt
981981
assert cb.ax.yaxis.get_minor_formatter() is fmt
982+
983+
984+
def test_offset_text_loc():
985+
fig, ax = plt.subplots()
986+
np.random.seed(seed=19680808)
987+
pc = ax.pcolormesh(np.random.randn(10, 10)*1e6)
988+
cb = fig.colorbar(pc, location='right', extend='max')
989+
fig.draw_without_rendering()
990+
# check that the offsetText is in the proper place above the
991+
# colorbar axes. In this case the colorbar axes is the same
992+
# height as the parent, so use the parents bbox.
993+
assert cb.ax.yaxis.offsetText.get_position()[1] > ax.bbox.y1

0 commit comments

Comments
 (0)