8000 Backport PR #14640: FIX: allow secondary axes to be non-linear · matplotlib/matplotlib@5aaa7b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5aaa7b1

Browse files
ivanovMeeseeksDev[bot]
authored andcommitted
Backport PR #14640: FIX: allow secondary axes to be non-linear
1 parent 5b1074d commit 5aaa7b1

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)
0