8000 TST: test colorbar tick labels correct · matplotlib/matplotlib@e5d7fd4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e5d7fd4

Browse files
committed
TST: test colorbar tick labels correct
1 parent eb5c4b2 commit e5d7fd4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_colorbar.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,18 @@ def test_colorbar_axes_kw():
396396
plt.imshow(([[1, 2], [3, 4]]))
397397
plt.colorbar(orientation='horizontal', fraction=0.2, pad=0.2, shrink=0.5,
398398
aspect=10, anchor=(0., 0.), panchor=(0., 1.))
399+
400+
401+
def test_colorbar_log_minortick_labels():
402+
with rc_context({'_internal.classic_mode': False}):
403+
fig, ax = plt.subplots()
404+
pcm = ax.imshow([[10000, 50000]], norm=LogNorm())
405+
cb = fig.colorbar(pcm)
406+
fig.canvas.draw()
407+
lb = cb.ax.yaxis.get_ticklabels(which='both')
408+
expected = [r'$\mathdefault{10^{4}}$',
409+
r'$\mathdefault{2\times10^{4}}$',
410+
r'$\mathdefault{3\times10^{4}}$',
411+
r'$\mathdefault{4\times10^{4}}$']
412+
for l, exp in zip(lb, expected):
413+
assert l.get_text() == exp

0 commit comments

Comments
 (0)
0