@@ -62,7 +62,7 @@ def __init__(self, parent, orientation,
6262 self ._axis = self .yaxis
6363 self ._locstrings = ['right' , 'left' ]
6464 self ._otherstrings = ['top' , 'bottom' ]
65- self ._parentscale = self . _axis . get_scale ()
65+ self ._parentscale = None
6666 # this gets positioned w/o constrained_layout so exclude:
6767 self ._layoutbox = None
6868 self ._poslayoutbox = None
@@ -189,21 +189,6 @@ def set_functions(self, functions):
189189 If a transform is supplied, then the transform must have an
190190 inverse.
191191 """
192-
193- if self ._orientation == 'x' :
194- set_scale = self .set_xscale
195- parent_scale = self ._parent .get_xscale ()
196- else :
197- set_scale = self .set_yscale
198- parent_scale = self ._parent .get_yscale ()
199- # we need to use a modified scale so the scale can receive the
200- # transform. Only types supported are linear and log10 for now.
201- # Probably possible to add other transforms as a todo...
202- if parent_scale == 'log' :
203- defscale = 'functionlog'
204- else :
205- defscale = 'function'
206-
207192 if (isinstance (functions , tuple ) and len (functions ) == 2 and
208193 callable (functions [0 ]) and callable (functions [1 ])):
209194 # make an arbitrary convert from a two-tuple of functions
@@ -216,8 +201,7 @@ def set_functions(self, functions):
216201 'must be a two-tuple of callable functions '
217202 'with the first function being the transform '
218203 'and the second being the inverse' )
219- # need to invert the roles here for the ticks to line up.
220- set_scale (defscale , functions = self ._functions [::- 1 ])
204+ self ._set_scale ()
221205
222206 def draw (self , renderer = None , inframe = False ):
223207 """
@@ -246,8 +230,6 @@ def _set_scale(self):
246230 set_scale = self .set_yscale
247231 if pscale == self ._parentscale :
248232 return
249- else :
250- self ._parentscale = pscale
251233
252234 if pscale == 'log' :
253235 defscale = 'functionlog'
@@ -265,6 +247,9 @@ def _set_scale(self):
265247 if self ._ticks_set :
266248 self ._axis .set_major_locator (mticker .FixedLocator (ticks ))
267249
250+ # If the parent scale doesn't change, we can skip this next time.
251+ self ._parentscale = pscale
252+
268253 def _set_lims (self ):
269254 """
270255 Set the limits based on parent limits and the convert method
0 commit comments