Skip to content

Commit 3f5b68d

Browse files
committed
Cleanup xticks/yticks docstrings.
- Don't bother listing call signatures (the normal function signature is fine). - Slightly tighten the parameters/return value descriptions.
1 parent 907efd0 commit 3f5b68d

File tree

1 file changed

+24
-62
lines changed

1 file changed

+24
-62
lines changed

lib/matplotlib/pyplot.py

+24-62
Original file line numberDiff line numberDiff line change
@@ -1372,29 +1372,23 @@ def xticks(ticks=None, labels=None, **kwargs):
13721372
"""
13731373
Get or set the current tick locations and labels of the x-axis.
13741374
1375-
Call signatures::
1376-
1377-
locs, labels = xticks() # Get locations and labels
1378-
xticks(ticks, [labels], **kwargs) # Set locations and labels
1375+
Pass no arguments to return the current values without modifying them.
13791376
13801377
Parameters
13811378
----------
1382-
ticks : array-like
1383-
A list of positions at which ticks should be placed. You can pass an
1384-
empty list to disable xticks.
1385-
1379+
ticks : array-like, optional
1380+
The list of xtick locations. Passing an empty list removes all xticks.
13861381
labels : array-like, optional
1387-
A list of explicit labels to place at the given *locs*.
1388-
1382+
The labels to place at the given *ticks* locations.
13891383
**kwargs
13901384
`.Text` properties can be used to control the appearance of the labels.
13911385
13921386
Returns
13931387
-------
13941388
locs
1395-
An array of label locations.
1389+
The list of xtick locations.
13961390
labels
1397-
A list of `.Text` objects.
1391+
The list of xlabel `.Text` objects.
13981392
13991393
Notes
14001394
-----
@@ -1406,25 +1400,12 @@ def xticks(ticks=None, labels=None, **kwargs):
14061400
14071401
Examples
14081402
--------
1409-
Get the current locations and labels:
1410-
1411-
>>> locs, labels = xticks()
1412-
1413-
Set label locations:
1414-
1415-
>>> xticks(np.arange(0, 1, step=0.2))
1416-
1417-
Set text labels:
1418-
1419-
>>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1420-
1421-
Set text labels and properties:
1422-
1423-
>>> xticks(np.arange(12), calendar.month_name[1:13], rotation=20)
1424-
1425-
Disable xticks:
1426-
1427-
>>> xticks([])
1403+
>>> locs, labels = xticks() # Get the current locations and labels.
1404+
>>> xticks(np.arange(0, 1, step=0.2)) # Set label locations.
1405+
>>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1406+
>>> xticks([0, 1, 2], ['January', 'February', 'March'],
1407+
... rotation=20) # Set text labels and properties.
1408+
>>> xticks([]) # Disable xticks.
14281409
"""
14291410
ax = gca()
14301411

@@ -1447,29 +1428,23 @@ def yticks(ticks=None, labels=None, **kwargs):
14471428
"""
14481429
Get or set the current tick locations and labels of the y-axis.
14491430
1450-
Call signatures::
1451-
1452-
locs, labels = yticks() # Get locations and labels
1453-
yticks(ticks, [labels], **kwargs) # Set locations and labels
1431+
Pass no arguments to return the current values without modifying them.
14541432
14551433
Parameters
14561434
----------
1457-
ticks : array-like
1458-
A list of positions at which ticks should be placed. You can pass an
1459-
empty list to disable yticks.
1460-
1435+
ticks : array-like, optional
1436+
The list of xtick locations. Passing an empty list removes all xticks.
14611437
labels : array-like, optional
1462-
A list of explicit labels to place at the given *locs*.
1463-
1438+
The labels to place at the given *ticks* locations.
14641439
**kwargs
14651440
`.Text` properties can be used to control the appearance of the labels.
14661441
14671442
Returns
14681443
-------
14691444
locs
1470-
An array of label locations.
1445+
The list of ytick locations.
14711446
labels
1472-
A list of `.Text` objects.
1447+
The list of ylabel `.Text` objects.
14731448
14741449
Notes
14751450
-----
@@ -1481,25 +1456,12 @@ def yticks(ticks=None, labels=None, **kwargs):
14811456
14821457
Examples
14831458
--------
1484-
Get the current locations and labels:
1485-
1486-
>>> locs, labels = yticks()
1487-
1488-
Set label locations:
1489-
1490-
>>> yticks(np.arange(0, 1, step=0.2))
1491-
1492-
Set text labels:
1493-
1494-
>>> yticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1495-
1496-
Set text labels and properties:
1497-
1498-
>>> yticks(np.arange(12), calendar.month_name[1:13], rotation=45)
1499-
1500-
Disable yticks:
1501-
1502-
>>> yticks([])
1459+
>>> locs, labels = yticks() # Get the current locations and labels.
1460+
>>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.
1461+
>>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1462+
>>> yticks([0, 1, 2], ['January', 'February', 'March'],
1463+
... rotation=45) # Set text labels and properties.
1464+
>>> yticks([]) # Disable yticks.
15031465
"""
15041466
ax = gca()
15051467

0 commit comments

Comments
 (0)