MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _set_scale

Method _set_scale

lib/matplotlib/axes/_secondary_axes.py:222–249  ·  view source on GitHub ↗

Check if parent has set its scale

(self)

Source from the content-addressed store, hash-verified

220 super().draw(renderer)
221
222 def _set_scale(self):
223 """
224 Check if parent has set its scale
225 """
226
227 if self._orientation == 'x':
228 pscale = self._parent.xaxis.get_scale()
229 set_scale = self.set_xscale
230 else: # 'y'
231 pscale = self._parent.yaxis.get_scale()
232 set_scale = self.set_yscale
233 if pscale == self._parentscale:
234 return
235
236 if self._ticks_set:
237 ticks = self._axis.get_ticklocs()
238
239 # need to invert the roles here for the ticks to line up.
240 set_scale('functionlog' if pscale == 'log' else 'function',
241 functions=self._functions[::-1])
242
243 # OK, set_scale sets the locators, but if we've called
244 # axsecond.set_ticks, we want to keep those.
245 if self._ticks_set:
246 self._axis.set_major_locator(mticker.FixedLocator(ticks))
247
248 # If the parent scale doesn't change, we can skip this next time.
249 self._parentscale = pscale
250
251 def _set_lims(self):
252 """

Callers 3

set_functionsMethod · 0.95
drawMethod · 0.95
__clearMethod · 0.45

Calls 3

get_scaleMethod · 0.80
get_ticklocsMethod · 0.80
set_major_locatorMethod · 0.45

Tested by

no test coverage detected