Skip to content

Make functions param to secondary_x/yaxis not keyword-only. #28133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion galleries/users_explain/quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def my_plotter(ax, data1, data2, param_dict):

ax3.plot(t, s)
ax3.set_xlabel('Angle [rad]')
ax4 = ax3.secondary_xaxis('top', functions=(np.rad2deg, np.deg2rad))
ax4 = ax3.secondary_xaxis('top', (np.rad2deg, np.deg2rad))
ax4.set_xlabel('Angle [°]')

# %%
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
return self.indicate_inset(rect, inset_ax, **kwargs)

@_docstring.dedent_interpd
def secondary_xaxis(self, location, *, functions=None, transform=None, **kwargs):
def secondary_xaxis(self, location, functions=None, *, transform=None, **kwargs):
"""
Add a second x-axis to this `~.axes.Axes`.

Expand Down Expand Up @@ -624,7 +624,7 @@ def invert(x):
return secondary_ax

@_docstring.dedent_interpd
def secondary_yaxis(self, location, *, functions=None, transform=None, **kwargs):
def secondary_yaxis(self, location, functions=None, *, transform=None, **kwargs):
"""
Add a second y-axis to this `~.axes.Axes`.

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,24 @@ class Axes(_AxesBase):
def secondary_xaxis(
self,
location: Literal["top", "bottom"] | float,
*,
functions: tuple[
Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
]
| Transform
| None = ...,
*,
transform: Transform | None = ...,
**kwargs
) -> SecondaryAxis: ...
def secondary_yaxis(
self,
location: Literal["left", "right"] | float,
*,
functions: tuple[
Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
]
| Transform
| None = ...,
*,
transform: Transform | None = ...,
**kwargs
) -> SecondaryAxis: ...
Expand Down
Loading