@@ -444,13 +444,6 @@ def draw_all(self):
444444
445445 def config_axis (self ):
446446 ax = self .ax
447- if (isinstance (self .norm , colors .LogNorm )
448- and self ._use_auto_colorbar_locator ()):
449- # *both* axes are made log so that determining the
450- # mid point is easier.
451- ax .set_xscale ('log' )
452- ax .set_yscale ('log' )
453-
454447
455448 if self .orientation == 'vertical' :
456449 long_axis , short_axis = ax .yaxis , ax .xaxis
@@ -1103,6 +1096,7 @@ def __init__(self, ax, mappable, **kw):
11031096 kw ['alpha' ] = mappable .get_alpha ()
11041097
11051098 ColorbarBase .__init__ (self , ax , ** kw )
1099+ self .update_normal (mappable )
11061100
11071101 def on_mappable_changed (self , mappable ):
11081102 """
@@ -1112,6 +1106,7 @@ def on_mappable_changed(self, mappable):
11121106 by :func:`colorbar_factory` and should not be called manually.
11131107
11141108 """
1109+ _log .debug ('mappable changed' )
11151110 self .set_cmap (mappable .get_cmap ())
11161111 self .set_clim (mappable .get_clim ())
11171112 self .update_normal (mappable )
@@ -1150,10 +1145,25 @@ def update_normal(self, mappable):
11501145 have been customized, they will need to be customized again.
11511146 """
11521147
1148+ _log .debug ('update normal' )
11531149 self .mappable = mappable
1154- self .norm = self .mappable .norm
1150+ self .set_alpha (mappable .get_alpha ())
1151+ self .cmap = mappable .cmap
1152+ self .norm = mappable .norm
11551153 self .locator = None
11561154 self .formatter = None
1155+ if (isinstance (self .norm , colors .LogNorm )
1156+ and self ._use_auto_colorbar_locator ()):
1157+ # *both* axes are made log so that determining the
1158+ # mid point is easier.
1159+ self .ax .set_xscale ('log' )
1160+ self .ax .set_yscale ('log' )
1161+ print ('Log!' )
1162+ else :
1163+ self .ax .set_xscale ('linear' )
1164+ self .ax .set_yscale ('linear' )
1165+ print ('Linear!' )
1166+
11571167 self .draw_all ()
11581168 if isinstance (self .mappable , contour .ContourSet ):
11591169 CS = self .mappable
@@ -1177,17 +1187,14 @@ def update_bruteforce(self, mappable):
11771187 self .ax .cla ()
11781188 self .locator = None
11791189 self .formatter = None
1180- self .mappable = mappable
11811190
11821191 # clearing the axes will delete outline, patch, solids, and lines:
11831192 self .outline = None
11841193 self .patch = None
11851194 self .solids = None
11861195 self .lines = list ()
11871196 self .dividers = None
1188- self .set_alpha (mappable .get_alpha ())
1189- self .cmap = mappable .cmap
1190- self .norm = mappable .norm
1197+ self .update_normal (mappable )
11911198 self .draw_all ()
11921199 if isinstance (self .mappable , contour .ContourSet ):
11931200 CS = self .mappable
0 commit comments