@@ -444,13 +444,6 @@ def draw_all(self):
444
444
445
445
def config_axis (self ):
446
446
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
-
454
447
455
448
if self .orientation == 'vertical' :
456
449
long_axis , short_axis = ax .yaxis , ax .xaxis
@@ -1103,6 +1096,7 @@ def __init__(self, ax, mappable, **kw):
1103
1096
kw ['alpha' ] = mappable .get_alpha ()
1104
1097
1105
1098
ColorbarBase .__init__ (self , ax , ** kw )
1099
+ self .update_normal (mappable )
1106
1100
1107
1101
def on_mappable_changed (self , mappable ):
1108
1102
"""
@@ -1112,6 +1106,7 @@ def on_mappable_changed(self, mappable):
1112
1106
by :func:`colorbar_factory` and should not be called manually.
1113
1107
1114
1108
"""
1109
+ _log .debug ('mappable changed' )
1115
1110
self .set_cmap (mappable .get_cmap ())
1116
1111
self .set_clim (mappable .get_clim ())
1117
1112
self .update_normal (mappable )
@@ -1150,10 +1145,25 @@ def update_normal(self, mappable):
1150
1145
have been customized, they will need to be customized again.
1151
1146
"""
1152
1147
1148
+ _log .debug ('update normal' )
1153
1149
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
1155
1153
self .locator = None
1156
1154
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
+
1157
1167
self .draw_all ()
1158
1168
if isinstance (self .mappable , contour .ContourSet ):
1159
1169
CS = self .mappable
@@ -1177,17 +1187,14 @@ def update_bruteforce(self, mappable):
1177
1187
self .ax .cla ()
1178
1188
self .locator = None
1179
1189
self .formatter = None
1180
- self .mappable = mappable
1181
1190
1182
1191
# clearing the axes will delete outline, patch, solids, and lines:
1183
1192
self .outline = None
1184
1193
self .patch = None
1185
1194
self .solids = None
1186
1195
self .lines = list ()
1187
1196
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 )
1191
1198
self .draw_all ()
1192
1199
if isinstance (self .mappable , contour .ContourSet ):
1193
1200
CS = self .mappable
0 commit comments