Skip to content

Commit ee4f8c7

Browse files
committed
Make functions param to secondary_x/yaxis not keyword-only.
I suspect the parameter was made keyword-only because the originally planned signature was `secondary_xaxis(location, forward=..., inverse=...)` where the keywords actually add some semantics (though that signature overall seems worse); however, for a single `functions` parameter, having to type an extra `functions=` in the call doesn't help the reader much (either they know what secondary_x/yaxis does, in which case the explicit kwarg doesn't matter, or they don't, in which case the kwarg name hardly helps)... and is a bit annoying. See the modified gallery entry, for example.
1 parent eb62d69 commit ee4f8c7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

galleries/users_explain/quick_start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def my_plotter(ax, data1, data2, param_dict):
496496

497497
ax3.plot(t, s)
498498
ax3.set_xlabel('Angle [rad]')
499-
ax4 = ax3.secondary_xaxis('top', functions=(np.rad2deg, np.deg2rad))
499+
ax4 = ax3.secondary_xaxis('top', (np.rad2deg, np.deg2rad))
500500
ax4.set_xlabel('Angle [°]')
501501

502502
# %%

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
570570
return self.indicate_inset(rect, inset_ax, **kwargs)
571571

572572
@_docstring.dedent_interpd
573-
def secondary_xaxis(self, location, *, functions=None, transform=None, **kwargs):
573+
def secondary_xaxis(self, location, functions=None, *, transform=None, **kwargs):
574574
"""
575575
Add a second x-axis to this `~.axes.Axes`.
576576
@@ -624,7 +624,7 @@ def invert(x):
624624
return secondary_ax
625625

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy