Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a98826e

Browse files
committed
improve docstrings of pyplot.xlabel and pyplot.ylabel
1 parent b2b8877 commit a98826e

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

lib/matplotlib/axes/_axes.py

Lines 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

Lines changed: 10 additions & 23 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 the pyplot equivalent of 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 the pyplot equivalent of 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

0 commit comments

Comments
 (0)