Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7cb314d

Browse filesBrowse files
committed
improve docstrings of pyplot.xlabel and pyplot.ylabel
1 parent 99347e6 commit 7cb314d
Copy full SHA for 7cb314d

File tree

Expand file treeCollapse file tree

2 files changed

+26
-37
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+26
-37
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,20 @@ def get_xlabel(self):
210210

211211
def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs):
212212
"""
213-
Set the label for the xaxis.
213+
Set the label for the x-axis.
214214
215215
Parameters
216216
----------
217-
xlabel : string
218-
x label
217+
xlabel : str
218+
The label text.
219219
220220
labelpad : scalar, optional, default: None
221-
spacing in points between the label and the x-axis
221+
Spacing in points between the label and the x-axis.
222222
223223
Other Parameters
224224
----------------
225-
**kwargs : `~matplotlib.text.Text` properties
225+
**kwargs : `.Text` properties
226+
`.Text` properties control the appearance of the label.
226227
227228
See also
228229
--------
@@ -241,19 +242,20 @@ def get_ylabel(self):
241242

242243
def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
243244
"""
244-
Set the label for the yaxis
245+
Set the label for the y-axis.
245246
246247
Parameters
247248
----------
248-
ylabel : string
249-
y label
249+
ylabel : str
250+
The label text.
250251
251252
labelpad : scalar, optional, default: None
252-
spacing in points between the label and the y-axis
253+
Spacing in points between the label and the y-axis.
253254
254255
Other Parameters
255256
----------------
256-
**kwargs : `~matplotlib.text.Text` properties
257+
**kwargs : `.Text` properties
258+
`.Text` properties control the appearance of the label.
257259
258260
See also
259261
--------

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+14-27Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,41 +1500,28 @@ def axis(*v, **kwargs):
15001500

15011501
def xlabel(s, *args, **kwargs):
15021502
"""
1503-
Set the *x* axis label of the current axis.
1503+
Set the x-axis label of the current axes.
15041504
1505-
Default override is::
1506-
1507-
override = {
1508-
'fontsize' : 'small',
1509-
'verticalalignment' : 'top',
1510-
'horizontalalignment' : 'center'
1511-
}
1505+
Call signature::
15121506
1513-
.. seealso::
1507+
xlabel(label, fontdict=None, labelpad=None, **kwargs)
15141508
1515-
:func:`~matplotlib.pyplot.text`
1516-
For information on how override and the optional args work
1509+
This is just a shortcut for calling `.set_xlabel` on the current axes.
1510+
See there for a full parameter description.
15171511
"""
15181512
return gca().set_xlabel(s, *args, **kwargs)
15191513

15201514

15211515
def ylabel(s, *args, **kwargs):
15221516
"""
1523-
Set the *y* axis label of the current axis.
1517+
Set the y-axis label of the current axes.
15241518
1525-
Defaults override is::
1526-
1527-
override = {
1528-
'fontsize' : 'small',
1529-
'verticalalignment' : 'center',
1530-
'horizontalalignment' : 'right',
1531-
'rotation'='vertical' : }
1519+
Call signature::
15321520
1533-
.. seealso::
1521+
ylabel(label, fontdict=None, labelpad=None, **kwargs)
15341522
1535-
:func:`~matplotlib.pyplot.text`
1536-
For information on how override and the optional args
1537-
work.
1523+
This is just a shortcut for calling `.set_ylabel` on the current axes.
1524+
See there for a full parameter description.
15381525
"""
15391526
return gca().set_ylabel(s, *args, **kwargs)
15401527

@@ -1565,7 +1552,7 @@ def xlim(*args, **kwargs):
15651552
Notes
15661553
-----
15671554
This is just a shortcut for calling `~.Axes.get_xlim` or `~.Axes.set_xlim`
1568-
on the current axes. All parameters are passed to the latter.
1555+
on the current axes.
15691556
"""
15701557
ax = gca()
15711558
if not args and not kwargs:
@@ -1600,7 +1587,7 @@ def ylim(*args, **kwargs):
16001587
Notes
16011588
-----
16021589
This is just a shortcut for calling `~.Axes.get_ylim` or `~.Axes.set_ylim`
1603-
on the current axes. All parameters are passed to the latter.
1590+
on the current axes.
16041591
"""
16051592
ax = gca()
16061593
if not args and not kwargs:
@@ -1679,7 +1666,7 @@ def xticks(*args, **kwargs):
16791666
-----
16801667
This is just a convenient shortcut for calling `.get_xticks` and
16811668
`.get_xticklabels` or `.set_xticks` and `.set_xticklabels` on the current
1682-
axes.
1669+
axes. All parameters are passed to the latter.
16831670
16841671
Examples
16851672
--------
@@ -1755,7 +1742,7 @@ def yticks(*args, **kwargs):
17551742
-----
17561743
This is just a convenient shortcut for calling `.get_yticks` and
17571744
`.get_yticklabels` or `.set_yticks` and `.set_yticklabels` on the current
1758-
axes.
1745+
axes. All parameters are passed to the latter.
17591746
17601747
Examples
17611748
--------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.