@@ -740,6 +740,7 @@ def __init__(self, *args, **kwargs):
740740 self ._title_pad_current = None
741741 self ._altx_parent = None # for cartesian axes only
742742 self ._alty_parent = None
743+ self ._colorbar_fill = None
743744 self ._inset_parent = None
744745 self ._inset_bounds = None # for introspection ony
745746 self ._inset_zoom = False
@@ -1563,6 +1564,8 @@ def draw(self, renderer=None, *args, **kwargs):
15631564 # to run them before aligning labels. So these are harmless no-ops.
15641565 self ._draw_guides ()
15651566 self ._apply_title_above ()
1567+ if self ._colorbar_fill and not getattr (self ._colorbar_fill , '_use_auto_colorbar_locator' , lambda : True )(): # noqa: E501
1568+ self ._colorbar_fill .update_ticks () # ticks are not updated otherwise!
15661569 if self ._inset_parent is not None and self ._inset_zoom :
15671570 self .indicate_inset_zoom ()
15681571 super ().draw (renderer , * args , ** kwargs )
@@ -2289,7 +2292,7 @@ def _draw_colorbar(
22892292 mappable .extend = extend # required in mpl >= 3.3, else optional
22902293 else :
22912294 kwargs ['extend' ] = extend
2292- obj = self .figure .colorbar (mappable , ** kwargs )
2295+ obj = cax . _colorbar_fill = self .figure .colorbar (mappable , ** kwargs )
22932296
22942297 # Update tickers, labels, and tick labels
22952298 # WARNING: Must use colorbar set_label to set text, calling
0 commit comments