@@ -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
@@ -195,21 +195,6 @@ def set_functions(self, functions):
195195 If a transform is supplied, then the transform must have an
196196 inverse.
197197 """
198-
199- if self ._orientation == 'x' :
200- set_scale = self .set_xscale
201- parent_scale = self ._parent .get_xscale ()
202- else :
203- set_scale = self .set_yscale
204- parent_scale = self ._parent .get_yscale ()
205- # we need to use a modified scale so the scale can receive the
206- # transform. Only types supported are linear and log10 for now.
207- # Probably possible to add other transforms as a todo...
208- if parent_scale == 'log' :
209- defscale = 'functionlog'
210- else :
211- defscale = 'function'
212-
213198 if (isinstance (functions , tuple ) and len (functions ) == 2 and
214199 callable (functions [0 ]) and callable (functions [1 ])):
215200 # make an arbitrary convert from a two-tuple of functions
@@ -222,8 +207,7 @@ def set_functions(self, functions):
222207 'must be a two-tuple of callable functions '
223208 'with the first function being the transform '
224209 'and the second being the inverse' )
225- # need to invert the roles here for the ticks to line up.
226- set_scale (defscale , functions = self ._functions [::- 1 ])
210+ self ._set_scale ()
227211
228212 def draw (self , renderer = None , inframe = False ):
229213 """
@@ -252,8 +236,6 @@ def _set_scale(self):
252236 set_scale = self .set_yscale
253237 if pscale == self ._parentscale :
254238 return
255- else :
256- self ._parentscale = pscale
257239
258240 if pscale == 'log' :
259241 defscale = 'functionlog'
@@ -271,6 +253,9 @@ def _set_scale(self):
271253 if self ._ticks_set :
272254 self ._axis .set_major_locator (mticker .FixedLocator (ticks ))
273255
256+ # If the parent scale doesn't change, we can skip this next time.
257+ self ._parentscale = pscale
258+
274259 def _set_lims (self ):
275260 """
276261 Set the limits based on parent limits and the convert method
0 commit comments