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

Skip to content

Commit 715f8fc

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 715f8fc

File tree

1 file changed

+24
-64
lines changed

1 file changed

+24
-64
lines changed

lib/matplotlib/pyplot.py

Lines changed: 24 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,30 +1371,23 @@ def ylim(*args, **kwargs):
13711371
def xticks(ticks=None, labels=None, **kwargs):
13721372
"""
13731373
Get or set the current tick locations and labels of the x-axis.
1374-
1375-
Call signatures::
1376-
1377-
locs, labels = xticks() # Get locations and labels
1378-
xticks(ticks, [labels], **kwargs) # Set locations and labels
1374+
Pass no arguments to return the current values without modifying them.
13791375
13801376
Parameters
13811377
----------
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-
1378+
ticks : array-like, optional
1379+
The list of xtick locations. Passing an empty list removes all xticks.
13861380
labels : array-like, optional
1387-
A list of explicit labels to place at the given *locs*.
1388-
1381+
The labels to place at the given *ticks* locations.
13891382
**kwargs
13901383
`.Text` properties can be used to control the appearance of the labels.
13911384
13921385
Returns
13931386
-------
13941387
locs
1395-
An array of label locations.
1388+
The list of xtick locations.
13961389
labels
1397-
A list of `.Text` objects.
1390+
The list of xlabel `.Text` objects.
13981391
13991392
Notes
14001393
-----
@@ -1406,25 +1399,12 @@ def xticks(ticks=None, labels=None, **kwargs):
14061399
14071400
Examples
14081401
--------
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([])
1402+
>>> locs, labels = xticks() # Get the current locations and labels.
1403+
>>> xticks(np.arange(0, 1, step=0.2)) # Set label locations.
1404+
>>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1405+
>>> xticks([0, 1, 2], ['January', 'February', 'March'],
1406+
... rotation=20) # Set text labels and properties.
1407+
>>> xticks([]) # Disable xticks.
14281408
"""
14291409
ax = gca()
14301410

@@ -1446,30 +1426,23 @@ def xticks(ticks=None, labels=None, **kwargs):
14461426
def yticks(ticks=None, labels=None, **kwargs):
14471427
"""
14481428
Get or set the current tick locations and labels of the y-axis.
1449-
1450-
Call signatures::
1451-
1452-
locs, labels = yticks() # Get locations and labels
1453-
yticks(ticks, [labels], **kwargs) # Set locations and labels
1429+
Pass no arguments to return the current values without modifying them.
14541430
14551431
Parameters
14561432
----------
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-
1433+
ticks : array-like, optional
1434+
The list of xtick locations. Passing an empty list removes all xticks.
14611435
labels : array-like, optional
1462-
A list of explicit labels to place at the given *locs*.
1463-
1436+
The labels to place at the given *ticks* locations.
14641437
**kwargs
14651438
`.Text` properties can be used to control the appearance of the labels.
14661439
14671440
Returns
14681441
-------
14691442
locs
1470-
An array of label locations.
1443+
The list of ytick locations.
14711444
labels
1472-
A list of `.Text` objects.
1445+
The list of ylabel `.Text` objects.
14731446
14741447
Notes
14751448
-----
@@ -1481,25 +1454,12 @@ def yticks(ticks=None, labels=None, **kwargs):
14811454
14821455
Examples
14831456
--------
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([])
1457+
>>> locs, labels = yticks() # Get the current locations and labels.
1458+
>>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.
1459+
>>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
1460+
>>> yticks([0, 1, 2], ['January', 'February', 'March'],
1461+
... rotation=45) # Set text labels and properties.
1462+
>>> yticks([]) # Disable yticks.
15031463
"""
15041464
ax = gca()
15051465

0 commit comments

Comments
 (0)