@@ -514,8 +514,28 @@ def test_colorbar_scale_reset():
514514def test_colorbar_get_ticks ():
515515 with rc_context ({'_internal.classic_mode' : False }):
516516
517- fig , ax = plt . subplots ()
517+ fig , ax = plt .subplots ()
518518 np .random .seed (19680801 )
519519 pc = ax .pcolormesh (np .random .rand (30 , 30 ))
520520 cb = fig .colorbar (pc )
521521 np .testing .assert_allclose (cb .get_ticks (), [0.2 , 0.4 , 0.6 , 0.8 ])
522+
523+
524+ def test_colorbar_inverted_ticks ():
525+ fig , axs = plt .subplots (2 )
526+ ax = axs [0 ]
527+ pc = ax .pcolormesh (10 ** np .arange (1 , 5 ).reshape (2 , 2 ), norm = LogNorm ())
528+ cbar = fig .colorbar (pc , ax = ax , extend = 'both' )
529+ ticks = cbar .get_ticks ()
530+ cbar .ax .invert_yaxis ()
531+ np .testing .assert_allclose (ticks , cbar .get_ticks ())
532+
533+ ax = axs [1 ]
534+ pc = ax .pcolormesh (np .arange (1 , 5 ).reshape (2 , 2 ))
535+ cbar = fig .colorbar (pc , ax = ax , extend = 'both' )
536+ cbar .minorticks_on ()
537+ ticks = cbar .get_ticks ()
538+ minorticks = cbar .get_ticks (minor = True )
539+ cbar .ax .invert_yaxis ()
540+ np .testing .assert_allclose (ticks , cbar .get_ticks ())
541+ np .testing .assert_allclose (minorticks , cbar .get_ticks (minor = True ))
0 commit comments