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

Skip to content

Commit 3c4e8f6

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 3c4e8f6

File tree

1 file changed

+26
-62
lines changed

1 file changed

+26
-62
lines changed

lib/matplotlib/pyplot.py

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,29 +1372,24 @@ 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. This argument can
1383+
only be passed if *ticks* is passed as well.
13891384
**kwargs
13901385
`.Text` properties can be used to control the appearance of the labels.
13911386
13921387
Returns
13931388
-------
13941389
locs
1395-
An array of label locations.
1390+
The list of xtick locations.
13961391
labels
1397-
A list of `.Text` objects.
1392+
The list of xlabel `.Text` objects.
13981393
13991394
Notes
14001395
-----
@@ -1406,25 +1401,12 @@ def xticks(ticks=None, labels=None, **kwargs):
14061401
14071402
Examples
14081403
--------
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([])
1404+
>>> locs, labels = xticks() # Get the current locations and labels.
1405+
>>> xticks(np.arange(0, 1, step=0.2)) # Set label locations.
1406+
>>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1407+
>>> xticks([0, 1, 2], ['January', 'February', 'March'],
1408+
... rotation=20) # Set text labels and properties.
1409+
>>> xticks([]) # Disable xticks.
14281410
"""
14291411
ax = gca()
14301412

@@ -1447,29 +1429,24 @@ def yticks(ticks=None, labels=None, **kwargs):
14471429
"""
14481430
Get or set the current tick locations and labels of the y-axis.
14491431
1450-
Call signatures::
1451-
1452-
locs, labels = yticks() # Get locations and labels
1453-
yticks(ticks, [labels], **kwargs) # Set locations and labels
1432+
Pass no arguments to return the current values without modifying them.
14541433
14551434
Parameters
14561435
----------
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-
1436+
ticks : array-like, optional
1437+
The list of xtick locations. Passing an empty list removes all xticks.
14611438
labels : array-like, optional
1462-
A list of explicit labels to place at the given *locs*.
1463-
1439+
The labels to place at the given *ticks* locations. This argument can
1440+
only be passed if *ticks* is passed as well.
14641441
**kwargs
14651442
`.Text` properties can be used to control the appearance of the labels.
14661443
14671444
Returns
14681445
-------
14691446
locs
1470-
An array of label locations.
1447+
The list of ytick locations.
14711448
labels
1472-
A list of `.Text` objects.
1449+
The list of ylabel `.Text` objects.
14731450
14741451
Notes
14751452
-----
@@ -1481,25 +1458,12 @@ def yticks(ticks=None, labels=None, **kwargs):
14811458
14821459
Examples
14831460
--------
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([])
1461+
>>> locs, labels = yticks() # Get the current locations and labels.
1462+
>>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.
1463+
>>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1464+
>>> yticks([0, 1, 2], ['January', 'February', 'March'],
1465+
... rotation=45) # Set text labels and properties.
1466+
>>> yticks([]) # Disable yticks.
15031467
"""
15041468
ax = gca()
15051469

0 commit comments

Comments
 (0)