@@ -1632,24 +1632,63 @@ def yscale(*args, **kwargs):
1632
1632
1633
1633
def xticks (* args , ** kwargs ):
1634
1634
"""
1635
- Get or set the *x*-limits of the current tick locations and labels.
1635
+ Get or set the current tick locations and labels of the x-axis .
1636
1636
1637
- ::
1637
+ Call signatures::
1638
+
1639
+ locs, labels = xticks() # Get locations and labels
1640
+
1641
+ xticks(locs, [labels], **kwargs) # Set locations and labels
1642
+
1643
+ Parameters
1644
+ ----------
1645
+ locs : array_like
1646
+ A list of positions at which ticks should be placed. You can pass an
1647
+ empty list to disable xticks.
1648
+
1649
+ labels : array_like, optional
1650
+ A list of explicit labels to place at the given *locs*.
1651
+
1652
+ **kwargs
1653
+ :class:`.Text` properties can be used to control the appearance of
1654
+ the labels.
1655
+
1656
+ Returns
1657
+ -------
1658
+ locs
1659
+ An array of label locations.
1660
+ labels
1661
+ A list of `.Text` objects.
1662
+
1663
+ Notes
1664
+ -----
1665
+ Calling this function with no arguments (e.g. ``xticks()``) is the pyplot
1666
+ equivalent of calling `~.Axes.get_xticks` and `~.Axes.get_xticklabels` on
1667
+ the current axes.
1668
+ Calling this function with arguments is the pyplot equivalent of calling
1669
+ `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current axes.
1670
+
1671
+ Examples
1672
+ --------
1673
+ Get the current locations and labels:
1674
+
1675
+ >>> locs, labels = xticks()
1676
+
1677
+ Set label locations:
1678
+
1679
+ >>> xticks(np.arange(0, 1, step=0.2))
1680
+
1681
+ Set text labels:
1638
1682
1639
- # return locs, labels where locs is an array of tick locations and
1640
- # labels is an array of tick labels.
1641
- locs, labels = xticks()
1683
+ >>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1642
1684
1643
- # set the locations of the xticks
1644
- xticks( arange(6) )
1685
+ Set text labels and properties:
1645
1686
1646
- # set the locations and labels of the xticks
1647
- xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
1687
+ >>> xticks(np.arange(12), calendar.month_name[1:13], rotation=20)
1648
1688
1649
- The keyword args, if any, are :class:`~matplotlib.text.Text`
1650
- properties. For example, to rotate long labels::
1689
+ Disable xticks:
1651
1690
1652
- xticks( arange(12), calendar.month_name[1:13], rotation=17 )
1691
+ >>> xticks([] )
1653
1692
"""
1654
1693
ax = gca ()
1655
1694
@@ -1672,24 +1711,63 @@ def xticks(*args, **kwargs):
1672
1711
1673
1712
def yticks (* args , ** kwargs ):
1674
1713
"""
1675
- Get or set the *y*-limits of the current tick locations and labels.
1714
+ Get or set the current tick locations and labels of the y-axis .
1676
1715
1677
- ::
1716
+ Call signatures::
1717
+
1718
+ locs, labels = yticks() # Get locations and labels
1719
+
1720
+ yticks(locs, [labels], **kwargs) # Set locations and labels
1721
+
1722
+ Parameters
1723
+ ----------
1724
+ locs : array_like
1725
+ A list of positions at which ticks should be placed. You can pass an
1726
+ empty list to disable yticks.
1727
+
1728
+ labels : array_like, optional
1729
+ A list of explicit labels to place at the given *locs*.
1730
+
1731
+ **kwargs
1732
+ :class:`.Text` properties can be used to control the appearance of
1733
+ the labels.
1734
+
1735
+ Returns
1736
+ -------
1737
+ locs
1738
+ An array of label locations.
1739
+ labels
1740
+ A list of `.Text` objects.
1741
+
1742
+ Notes
1743
+ -----
1744
+ Calling this function with no arguments (e.g. ``yticks()``) is the pyplot
1745
+ equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on
1746
+ the current axes.
1747
+ Calling this function with arguments is the pyplot equivalent of calling
1748
+ `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes.
1749
+
1750
+ Examples
1751
+ --------
1752
+ Get the current locations and labels:
1753
+
1754
+ >>> locs, labels = yticks()
1755
+
1756
+ Set label locations:
1757
+
1758
+ >>> yticks(np.arange(0, 1, step=0.2))
1759
+
1760
+ Set text labels:
1678
1761
1679
- # return locs, labels where locs is an array of tick locations and
1680
- # labels is an array of tick labels.
1681
- locs, labels = yticks()
1762
+ >>> yticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))
1682
1763
1683
- # set the locations of the yticks
1684
- yticks( arange(6) )
1764
+ Set text labels and properties:
1685
1765
1686
- # set the locations and labels of the yticks
1687
- yticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
1766
+ >>> yticks(np.arange(12), calendar.month_name[1:13], rotation=45)
1688
1767
1689
- The keyword args, if any, are :class:`~matplotlib.text.Text`
1690
- properties. For example, to rotate long labels::
1768
+ Disable yticks:
1691
1769
1692
- yticks( arange(12), calendar.month_name[1:13], rotation=45 )
1770
+ >>> yticks([] )
1693
1771
"""
1694
1772
ax = gca ()
1695
1773
0 commit comments