@@ -451,6 +451,7 @@ def __init__(self, ax, cmap=None,
451451 self .locator = None
452452 self .formatter = None
453453 self ._manual_tick_data_values = None
454+ self .__scale = None # linear, log10 for now. Hopefully more?
454455
455456 if ticklocation == 'auto' :
456457 ticklocation = 'bottom' if orientation == 'horizontal' else 'right'
@@ -584,8 +585,8 @@ def _use_auto_colorbar_locator(self):
584585 one. (check is used twice so factored out here...)
585586 """
586587 contouring = self .boundaries is not None and self .spacing == 'uniform'
587- return (type (self .norm ) in [colors .Normalize , colors .LogNorm ]
588- and not contouring )
588+ return (type (self .norm ) in [colors .Normalize , colors .LogNorm ] and
589+ not contouring )
589590
590591 def _reset_locator_formatter_scale (self ):
591592 """
@@ -601,9 +602,14 @@ def _reset_locator_formatter_scale(self):
601602 self .ax .set_xscale ('log' )
602603 self .ax .set_yscale ('log' )
603604 self .minorticks_on ()
605+ self .__scale = 'log'
604606 else :
605607 self .ax .set_xscale ('linear' )
606608 self .ax .set_yscale ('linear' )
609+ if type (self .norm ) is colors .Normalize :
610+ self .__scale = 'linear'
611+ else :
612+ self .__scale = 'manual'
607613
608614 def update_ticks (self ):
609615 """
@@ -1118,13 +1124,13 @@ def _mesh(self):
11181124 else :
11191125 y = self ._proportional_y ()
11201126 xmid = np .array ([0.5 ])
1121- try :
1127+ if self . __scale != 'manual' :
11221128 y = norm .inverse (y )
11231129 x = norm .inverse (x )
11241130 xmid = norm .inverse (xmid )
1125- except ValueError :
1126- # occurs for norms that don 't have an inverse, in
1127- # which case manually scale:
1131+ else :
1132+ # if a norm doesn 't have a named scale, or
1133+ # we are not using a norm
11281134 dv = self .vmax - self .vmin
11291135 x = x * dv + self .vmin
11301136 y = y * dv + self .vmin
0 commit comments