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

Skip to content

Commit 4a12b71

Browse files
authored
Merge pull request #14646 from meeseeksmachine/auto-backport-of-pr-14640-on-v3.1.x
Backport PR #14640 on branch v3.1.x (FIX: allow secondary axes to be non-linear)
2 parents 5b1074d + 5aaa7b1 commit 4a12b71

File tree

2 files changed

+4
-2
lines changed

2 files 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
@@ -243,7 +243,8 @@ def set_functions(self, functions):
243243
'must be a two-tuple of callable functions '
244244
'with the first function being the transform '
245245
'and the second being the inverse')
246-
set_scale(defscale, functions=self._functions)
246+
# need to invert the roles here for the ticks to line up.
247+
set_scale(defscale, functions=self._functions[::-1])
247248

248249
def draw(self, renderer=None, inframe=False):
249250
"""
@@ -280,7 +281,8 @@ def _set_scale(self):
280281
if self._ticks_set:
281282
ticks = self._axis.get_ticklocs()
282283

283-
set_scale(defscale, functions=self._functions)
284+
# need to invert the roles here for the ticks to line up.
285+
set_scale(defscale, functions=self._functions[::-1])
284286

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

0 commit comments

Comments
 (0)