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

Skip to content

Commit 377cdb1

Browse files
committed
improve docstrings of pyplot.xlabel and pyplot.ylabel
1 parent 5ead4ef commit 377cdb1

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
@@ -211,19 +211,20 @@ def get_xlabel(self):
211211

212212
def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs):
213213
"""
214-
Set the label for the xaxis.
214+
Set the label for the x-axis.
215215
216216
Parameters
217217
----------
218-
xlabel : string
219-
x label
218+
xlabel : str
219+
The label text.
220220
221221
labelpad : scalar, optional, default: None
222-
spacing in points between the label and the x-axis
222+
Spacing in points between the label and the x-axis.
223223
224224
Other Parameters
225225
----------------
226-
**kwargs : `~matplotlib.text.Text` properties
226+
**kwargs : `.Text` properties
227+
`.Text` properties control the appearance of the label.
227228
228229
See also
229230
--------
@@ -242,19 +243,20 @@ def get_ylabel(self):
242243

243244
def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
244245
"""
245-
Set the label for the yaxis
246+
Set the label for the y-axis.
246247
247248
Parameters
248249
----------
249-
ylabel : string
250-
y label
250+
ylabel : str
251+
The label text.
251252
252253
labelpad : scalar, optional, default: None
253-
spacing in points between the label and the y-axis
254+
Spacing in points between the label and the y-axis.
254255
255256
Other Parameters
256257
----------------
257-
**kwargs : `~matplotlib.text.Text` properties
258+
**kwargs : `.Text` properties
259+
`.Text` properties control the appearance of the label.
258260
259261
See also
260262
--------

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)