Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ca6b49

Browse files
committed
FIX: allow secondary axes to be non-linear
1 parent 896fb81 commit 7ca6b49

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ def set_functions(self, functions):
222222
'must be a two-tuple of callable functions '
223223
'with the first function being the transform '
224224
'and the second being the inverse')
225-
set_scale(defscale, functions=self._functions)
225+
# need to invert the roles here for the ticks to line up.
226+
set_scale(defscale, functions=self._functions[::-1])
226227

227228
def draw(self, renderer=None, inframe=False):
228229
"""
@@ -262,7 +263,8 @@ def _set_scale(self):
262263
if self._ticks_set:
263264
ticks = self._axis.get_ticklocs()
264265

265-
set_scale(defscale, functions=self._functions)
266+
# need to invert the roles here for the ticks to line up.
267+
set_scale(defscale, functions=self._functions[::-1])
266268

267269
# OK, set_scale sets the locators, but if we've called
268270
# axsecond.set_ticks, we want to keep those.

0 commit comments

Comments
 (0)