@@ -90,10 +90,15 @@ def set_location(self, location, transform=None):
90
90
91
91
transform : `.Transform`, optional
92
92
Transform for the location to use. Defaults to
93
- self._parent. transAxes, so locations are normally relative to
93
+ the parent's `` transAxes`` , so locations are normally relative to
94
94
the parent axes.
95
+
96
+ .. versionadded:: 3.8
95
97
"""
96
98
99
+ # Make sure transform is a Transform or None.
100
+ _api .check_isinstance ((transforms .Transform , None ), transform = transform )
101
+
97
102
# This puts the rectangle into figure-relative coordinates.
98
103
if isinstance (location , str ):
99
104
_api .check_in_list (self ._locstrings , location = location )
@@ -132,8 +137,7 @@ def set_location(self, location, transform=None):
132
137
# so it never needs to know where the parent is explicitly in
133
138
# figure coordinates.
134
139
# it gets called in ax.apply_aspect() (of all places)
135
- self .set_axes_locator (
136
- _TransformedBoundsLocator (bounds , transform ))
140
+ self .set_axes_locator (_TransformedBoundsLocator (bounds , transform ))
137
141
138
142
def apply_aspect (self , position = None ):
139
143
# docstring inherited.
@@ -281,12 +285,6 @@ def set_color(self, color):
281
285
parent axes to put the new axes, 0.0 being the bottom (or left)
282
286
and 1.0 being the top (or right).
283
287
284
- transform : `.Transform`, optional
285
- An optional transform that can be passed. *location* will be
286
- placed relative to this transform (in the direction of the axis)
287
- rather than the parent's axis. i.e. a secondary x-axis will
288
- use the provided y transform and the x transform of the parent.
289
-
290
288
functions : 2-tuple of func, or Transform with an inverse
291
289
292
290
If a 2-tuple of functions, the user specifies the transform
@@ -301,6 +299,14 @@ def set_color(self, color):
301
299
See :doc:`/gallery/subplots_axes_and_figures/secondary_axis`
302
300
for examples of making these conversions.
303
301
302
+ transform : `.Transform`, optional
303
+ An optional transform that can be passed. *location* will be
304
+ placed relative to this transform (in the direction of the axis)
305
+ rather than the parent's axis. i.e. a secondary x-axis will
306
+ use the provided y transform and the x transform of the parent.
307
+
308
+ .. versionadded:: 3.8
309
+
304
310
Returns
305
311
-------
306
312
ax : axes._secondary_axes.SecondaryAxis
0 commit comments