@@ -452,6 +452,7 @@ def __init__(self, ax, cmap=None,
452452 self .locator = None
453453 self .formatter = None
454454 self ._manual_tick_data_values = None
455+ self .__scale = None # linear, log10 for now. Hopefully more?
455456
456457 if ticklocation == 'auto' :
457458 ticklocation = 'bottom' if orientation == 'horizontal' else 'right'
@@ -585,8 +586,8 @@ def _use_auto_colorbar_locator(self):
585586 one. (check is used twice so factored out here...)
586587 """
587588 contouring = self .boundaries is not None and self .spacing == 'uniform'
588- return (type (self .norm ) in [colors .Normalize , colors .LogNorm ]
589- and not contouring )
589+ return (type (self .norm ) in [colors .Normalize , colors .LogNorm ] and
590+ not contouring )
590591
591592 def _reset_locator_formatter_scale (self ):
592593 """
@@ -602,9 +603,14 @@ def _reset_locator_formatter_scale(self):
602603 self .ax .set_xscale ('log' )
603604 self .ax .set_yscale ('log' )
604605 self .minorticks_on ()
606+ self .__scale = 'log'
605607 else :
606608 self .ax .set_xscale ('linear' )
607609 self .ax .set_yscale ('linear' )
610+ if type (self .norm ) is colors .Normalize :
611+ self .__scale = 'linear'
612+ else :
613+ self .__scale = 'manual'
608614
609615 def update_ticks (self ):
610616 """
@@ -1119,13 +1125,13 @@ def _mesh(self):
11191125 else :
11201126 y = self ._proportional_y ()
11211127 xmid = np .array ([0.5 ])
1122- try :
1128+ if self . __scale != 'manual' :
11231129 y = norm .inverse (y )
11241130 x = norm .inverse (x )
11251131 xmid = norm .inverse (xmid )
1126- except ValueError :
1127- # occurs for norms that don 't have an inverse, in
1128- # which case manually scale:
1132+ else :
1133+ # if a norm doesn 't have a named scale, or
1134+ # we are not using a norm
11291135 dv = self .vmax - self .vmin
11301136 x = x * dv + self .vmin
11311137 y = y * dv + self .vmin
0 commit comments