@@ -1497,65 +1497,60 @@ def axis(*v, **kwargs):
1497
1497
1498
1498
def xlabel (s , * args , ** kwargs ):
1499
1499
"""
1500
- Set the *x* axis label of the current axis .
1500
+ Set the x- axis label of the current axes .
1501
1501
1502
- Default override is::
1503
-
1504
- override = {
1505
- 'fontsize' : 'small',
1506
- 'verticalalignment' : 'top',
1507
- 'horizontalalignment' : 'center'
1508
- }
1502
+ Call signature::
1509
1503
1510
- .. seealso::
1504
+ xlabel(label, fontdict=None, labelpad=None, **kwargs)
1511
1505
1512
- :func:`~matplotlib.pyplot.text`
1513
- For information on how override and the optional args work
1506
+ This is the pyplot equivalent of calling `.set_xlabel` on the current axes.
1507
+ See there for a full parameter description.
1514
1508
"""
1515
1509
return gca ().set_xlabel (s , * args , ** kwargs )
1516
1510
1517
1511
1518
1512
def ylabel (s , * args , ** kwargs ):
1519
1513
"""
1520
- Set the *y* axis label of the current axis .
1514
+ Set the y- axis label of the current axes .
1521
1515
1522
- Defaults override is::
1523
-
1524
- override = {
1525
- 'fontsize' : 'small',
1526
- 'verticalalignment' : 'center',
1527
- 'horizontalalignment' : 'right',
1528
- 'rotation'='vertical' : }
1516
+ Call signature::
1529
1517
1530
- .. seealso::
1518
+ ylabel(label, fontdict=None, labelpad=None, **kwargs)
1531
1519
1532
- :func:`~matplotlib.pyplot.text`
1533
- For information on how override and the optional args
1534
- work.
1520
+ This is the pyplot equivalent of calling `.set_ylabel` on the current axes.
1521
+ See there for a full parameter description.
1535
1522
"""
1536
1523
return gca ().set_ylabel (s , * args , ** kwargs )
1537
1524
1538
1525
1539
1526
def xlim (* args , ** kwargs ):
1540
1527
"""
1541
- Get or set the *x* limits of the current axes.
1528
+ Get or set the x limits of the current axes.
1542
1529
1543
- ::
1530
+ Call signatures ::
1544
1531
1545
- xmin, xmax = xlim() # return the current xlim
1546
- xlim( (xmin, xmax) ) # set the xlim to xmin, xmax
1547
- xlim( xmin, xmax ) # set the xlim to xmin, xmax
1532
+ xmin, xmax = xlim() # return the current xlim
1533
+ xlim((xmin, xmax)) # set the xlim to xmin, xmax
1534
+ xlim(xmin, xmax) # set the xlim to xmin, xmax
1548
1535
1549
- If you do not specify args, you can pass the xmin and xmax as
1550
- kwargs, e.g.::
1536
+ If you do not specify args, you can pass *xmin* or *xmax* as kwargs, i.e.::
1551
1537
1552
- xlim(xmax=3) # adjust the max leaving min unchanged
1553
- xlim(xmin=1) # adjust the min leaving max unchanged
1538
+ xlim(xmax=3) # adjust the max leaving min unchanged
1539
+ xlim(xmin=1) # adjust the min leaving max unchanged
1554
1540
1555
1541
Setting limits turns autoscaling off for the x-axis.
1556
1542
1557
- The new axis limits are returned as a length 2 tuple.
1543
+ Returns
1544
+ -------
1545
+ xmin, xmax
1546
+ A tuple of the new x-axis limits.
1558
1547
1548
+ Notes
1549
+ -----
1550
+ Calling this function with no arguments (e.g. ``xlim()``) is the pyplot
1551
+ equivalent of calling `~.Axes.get_xlim` on the current axes.
1552
+ Calling this function with arguments is the pyplot equivalent of calling
1553
+ `~.Axes.set_xlim` on the current axes. All arguments are passed though.
1559
1554
"""
1560
1555
ax = gca ()
1561
1556
if not args and not kwargs :
@@ -1566,23 +1561,33 @@ def xlim(*args, **kwargs):
1566
1561
1567
1562
def ylim (* args , ** kwargs ):
1568
1563
"""
1569
- Get or set the *y* -limits of the current axes.
1564
+ Get or set the y -limits of the current axes.
1570
1565
1571
- ::
1566
+ Call signatures ::
1572
1567
1573
- ymin, ymax = ylim() # return the current ylim
1574
- ylim( (ymin, ymax) ) # set the ylim to ymin, ymax
1575
- ylim( ymin, ymax ) # set the ylim to ymin, ymax
1568
+ ymin, ymax = ylim() # return the current ylim
1569
+ ylim((ymin, ymax)) # set the ylim to ymin, ymax
1570
+ ylim(ymin, ymax) # set the ylim to ymin, ymax
1576
1571
1577
- If you do not specify args, you can pass the *ymin* and *ymax* as
1578
- kwargs, e.g .::
1572
+ If you do not specify args, you can alternatively pass *ymin* or *ymax* as
1573
+ kwargs, i.e .::
1579
1574
1580
- ylim(ymax=3) # adjust the max leaving min unchanged
1581
- ylim(ymin=1) # adjust the min leaving max unchanged
1575
+ ylim(ymax=3) # adjust the max leaving min unchanged
1576
+ ylim(ymin=1) # adjust the min leaving max unchanged
1582
1577
1583
1578
Setting limits turns autoscaling off for the y-axis.
1584
1579
1585
- The new axis limits are returned as a length 2 tuple.
1580
+ Returns
1581
+ -------
1582
+ ymin, ymax
1583
+ A tuple of the new y-axis limits.
1584
+
1585
+ Notes
1586
+ -----
1587
+ Calling this function with no arguments (e.g. ``ylim()``) is the pyplot
1588
+ equivalent of calling `~.Axes.get_ylim` on the current axes.
1589
+ Calling this function with arguments is the pyplot equivalent of calling
1590
+ `~.Axes.set_ylim` on the current axes. All arguments are passed though.
1586
1591
"""
1587
1592
ax = gca ()
1588
1593
if not args and not kwargs :
@@ -1594,13 +1599,23 @@ def ylim(*args, **kwargs):
1594
1599
@docstring .dedent_interpd
1595
1600
def xscale (* args , ** kwargs ):
1596
1601
"""
1597
- Set the scaling of the *x* -axis.
1602
+ Set the scaling of the x -axis.
1598
1603
1599
- call signature::
1604
+ Call signature::
1600
1605
1601
- xscale(scale, **kwargs)
1606
+ xscale(scale, **kwargs)
1602
1607
1603
- The available scales are: %(scale)s
1608
+ Parameters
1609
+ ----------
1610
+ scale : [%(scale)s]
1611
+ The scaling type.
1612
+ **kwargs
1613
+ Additional parameters depend on *scale*. See Notes.
1614
+
1615
+ Notes
1616
+ -----
1617
+ This is the pyplot equivalent of calling `~.Axes.set_xscale` on the
1618
+ current axes.
1604
1619
1605
1620
Different keywords may be accepted, depending on the scale:
1606
1621
@@ -1612,13 +1627,23 @@ def xscale(*args, **kwargs):
1612
1627
@docstring .dedent_interpd
1613
1628
def yscale (* args , ** kwargs ):
1614
1629
"""
1615
- Set the scaling of the *y* -axis.
1630
+ Set the scaling of the y -axis.
1616
1631
1617
- call signature::
1632
+ Call signature::
1633
+
1634
+ yscale(scale, **kwargs)
1618
1635
1619
- yscale(scale, **kwargs)
1636
+ Parameters
1637
+ ----------
1638
+ scale : [%(scale)s]
1639
+ The scaling type.
1640
+ **kwargs
1641
+ Additional parameters depend on *scale*. See Notes.
1620
1642
1621
- The available scales are: %(scale)s
1643
+ Notes
1644
+ -----
1645
+ This is the pyplot equivalent of calling `~.Axes.set_yscale` on the
1646
+ current axes.
1622
1647
1623
1648
Different keywords may be accepted, depending on the scale:
1624
1649
@@ -1629,24 +1654,63 @@ def yscale(*args, **kwargs):
1629
1654
1630
1655
def xticks (* args , ** kwargs ):
1631
1656
"""
1632
- Get or set the *x*-limits of the current tick locations and labels.
1657
+ Get or set the current tick locations and labels of the x-axis .
1633
1658
1634
- ::
1659
+ Call signatures ::
1635
1660
1636
- # return locs, labels where locs is an array of tick locations and
1637
- # labels is an array of tick labels.
1638
- locs, labels = xticks()
1661
+ locs, labels = xticks() # Get locations and labels
1639
1662
1640
- # set the locations of the xticks
1641
- xticks( arange(6) )
1663
+ xticks(locs, [labels], **kwargs) # Set locations and labels
1642
1664
1643
- # set the locations and labels of the xticks
1644
- xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
1665
+ Parameters
1666
+ ----------
1667
+ locs : array_like
1668
+ A list of positions at which ticks should be placed. You can pass an
1669
+ empty list to disable xticks.
1645
1670
1646
- The keyword args, if any, are :class:`~matplotlib.text.Text`
1647
- properties. For example, to rotate long labels::
1671
+ labels : array_like, optional
1672
+ A list of explicit labels to place at the given *locs*.
1648
1673
1649
- xticks( arange(12), calendar.month_name[1:13], rotation=17 )
1674
+ **kwargs
1675
+ :class:`.Text` properties can be used to control the appearance of
1676
+ the labels.
1677
+
1678
+ Returns
1679
+ -------
1680
+ locs
1681
+ An array of label locations.
1682
+ labels
1683
+ A list of `.Text` objects.
1684
+
1685
+ Notes
1686
+ -----
1687
+ Calling this function with no arguments (e.g. ``xticks()``) is the pyplot
1688
+ equivalent of calling `~.Axes.get_xticks` and `~.Axes.get_xticklabels` on
1689
+ the current axes.
1690
+ Calling this function with arguments is the pyplot equivalent of calling
1691
+ `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current axes.
1692
+
1693
+ Examples
1694
+ --------
1695
+ Get the current locations and labels:
1696
+
1697
+ >>> locs, labels = xticks()
1698
+
1699
+ Set label locations:
1700
+
1701
+ >>> xticks(np.arange(0, 1, step=0.2))
1702
+
1703
+ Set text labels:
1704
+
1705
+ >>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1706
+
1707
+ Set text labels and properties:
1708
+
1709
+ >>> xticks(np.arange(12), calendar.month_name[1:13], rotation=20)
1710
+
1711
+ Disable xticks:
1712
+
1713
+ >>> xticks([])
1650
1714
"""
1651
1715
ax = gca ()
1652
1716
@@ -1669,24 +1733,63 @@ def xticks(*args, **kwargs):
1669
1733
1670
1734
def yticks (* args , ** kwargs ):
1671
1735
"""
1672
- Get or set the *y*-limits of the current tick locations and labels.
1736
+ Get or set the current tick locations and labels of the y-axis.
1737
+
1738
+ Call signatures::
1739
+
1740
+ locs, labels = yticks() # Get locations and labels
1741
+
1742
+ yticks(locs, [labels], **kwargs) # Set locations and labels
1743
+
1744
+ Parameters
1745
+ ----------
1746
+ locs : array_like
1747
+ A list of positions at which ticks should be placed. You can pass an
1748
+ empty list to disable yticks.
1749
+
1750
+ labels : array_like, optional
1751
+ A list of explicit labels to place at the given *locs*.
1752
+
1753
+ **kwargs
1754
+ :class:`.Text` properties can be used to control the appearance of
1755
+ the labels.
1756
+
1757
+ Returns
1758
+ -------
1759
+ locs
1760
+ An array of label locations.
1761
+ labels
1762
+ A list of `.Text` objects.
1763
+
1764
+ Notes
1765
+ -----
1766
+ Calling this function with no arguments (e.g. ``yticks()``) is the pyplot
1767
+ equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on
1768
+ the current axes.
1769
+ Calling this function with arguments is the pyplot equivalent of calling
1770
+ `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes.
1771
+
1772
+ Examples
1773
+ --------
1774
+ Get the current locations and labels:
1775
+
1776
+ >>> locs, labels = yticks()
1777
+
1778
+ Set label locations:
1779
+
1780
+ >>> yticks(np.arange(0, 1, step=0.2))
1673
1781
1674
- : :
1782
+ Set text labels :
1675
1783
1676
- # return locs, labels where locs is an array of tick locations and
1677
- # labels is an array of tick labels.
1678
- locs, labels = yticks()
1784
+ >>> yticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1679
1785
1680
- # set the locations of the yticks
1681
- yticks( arange(6) )
1786
+ Set text labels and properties:
1682
1787
1683
- # set the locations and labels of the yticks
1684
- yticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
1788
+ >>> yticks(np.arange(12), calendar.month_name[1:13], rotation=45)
1685
1789
1686
- The keyword args, if any, are :class:`~matplotlib.text.Text`
1687
- properties. For example, to rotate long labels::
1790
+ Disable yticks:
1688
1791
1689
- yticks( arange(12), calendar.month_name[1:13], rotation=45 )
1792
+ >>> yticks([] )
1690
1793
"""
1691
1794
ax = gca ()
1692
1795
0 commit comments