MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_colorbar_autotickslog

Function test_colorbar_autotickslog

lib/matplotlib/tests/test_colorbar.py:489–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

487
488
489def test_colorbar_autotickslog():
490 # Test new autotick modes...
491 with rc_context({'_internal.classic_mode': False}):
492 fig, ax = plt.subplots(2, 1)
493 x = np.arange(-3.0, 4.001)
494 y = np.arange(-4.0, 3.001)
495 X, Y = np.meshgrid(x, y)
496 Z = X * Y
497 Z = Z[:-1, :-1]
498 pcm = ax[0].pcolormesh(X, Y, 10**Z, norm=LogNorm())
499 cbar = fig.colorbar(pcm, ax=ax[0], extend='both',
500 orientation='vertical')
501
502 pcm = ax[1].pcolormesh(X, Y, 10**Z, norm=LogNorm())
503 cbar2 = fig.colorbar(pcm, ax=ax[1], extend='both',
504 orientation='vertical', shrink=0.4)
505
506 fig.draw_without_rendering()
507 # note only -12 to +12 are visible
508 np.testing.assert_equal(np.log10(cbar.ax.yaxis.get_ticklocs()),
509 [-18, -12, -6, 0, +6, +12, +18])
510 np.testing.assert_equal(np.log10(cbar2.ax.yaxis.get_ticklocs()),
511 [-36, -12, 12, +36])
512
513
514def test_colorbar_get_ticks():

Callers

nothing calls this directly

Calls 6

rc_contextFunction · 0.90
pcolormeshMethod · 0.80
get_ticklocsMethod · 0.80
subplotsMethod · 0.45
colorbarMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…