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

Method set_functions

lib/matplotlib/axes/_secondary_axes.py:171–206  ·  view source on GitHub ↗

Set how the secondary axis converts limits from the parent Axes. Parameters ---------- functions : 2-tuple of func, or `Transform` with an inverse. Transform between the parent axis values and the secondary axis values. If suppli

(self, functions)

Source from the content-addressed store, hash-verified

169 return ret
170
171 def set_functions(self, functions):
172 """
173 Set how the secondary axis converts limits from the parent Axes.
174
175 Parameters
176 ----------
177 functions : 2-tuple of func, or `Transform` with an inverse.
178 Transform between the parent axis values and the secondary axis
179 values.
180
181 If supplied as a 2-tuple of functions, the first function is
182 the forward transform function and the second is the inverse
183 transform.
184
185 If a transform is supplied, then the transform must have an
186 inverse.
187 """
188
189 if (isinstance(functions, tuple) and len(functions) == 2 and
190 callable(functions[0]) and callable(functions[1])):
191 # make an arbitrary convert from a two-tuple of functions
192 # forward and inverse.
193 self._functions = functions
194 elif isinstance(functions, Transform):
195 self._functions = (
196 functions.transform,
197 lambda x: functions.inverted().transform(x)
198 )
199 elif functions is None:
200 self._functions = (lambda x: x, lambda x: x)
201 else:
202 raise ValueError('functions argument of secondary Axes '
203 'must be a two-tuple of callable functions '
204 'with the first function being the transform '
205 'and the second being the inverse')
206 self._set_scale()
207
208 def draw(self, renderer):
209 """

Callers 1

__init__Method · 0.95

Calls 3

_set_scaleMethod · 0.95
transformMethod · 0.45
invertedMethod · 0.45

Tested by

no test coverage detected