@@ -1626,36 +1626,62 @@ def yticks(ticks=None, labels=None, **kwargs):
1626
1626
1627
1627
return locs , silent_list ('Text yticklabel' , labels )
1628
1628
1629
-
1630
1629
def rgrids (* args , ** kwargs ):
1631
1630
"""
1632
- Get or set the radial gridlines on a polar plot.
1631
+ Get or set the radial gridlines on the current polar plot.
1632
+
1633
+ Call signatures::
1633
1634
1634
- call signatures::
1635
+ lines, labels = rgrids()
1636
+ lines, labels = rgrids(radii, labels=None, angle=22.5, fmt=None, **kwargs)
1635
1637
1636
- lines, labels = rgrids()
1637
- lines, labels = rgrids(radii, labels=None, angle=22.5, **kwargs)
1638
+ When called with no arguments, `.rgrids` simply returns the tuple
1639
+ (*lines*, *labels*). When called with arguments, the labels will
1640
+ appear at the specified radial distances and angle.
1638
1641
1639
- When called with no arguments, :func:`rgrid` simply returns the
1640
- tuple (*lines*, *labels*), where *lines* is an array of radial
1641
- gridlines (:class:`~matplotlib.lines.Line2D` instances) and
1642
- *labels* is an array of tick labels
1643
- (:class:`~matplotlib.text.Text` instances). When called with
1644
- arguments, the labels will appear at the specified radial
1645
- distances and angles.
1642
+ Parameters
1643
+ ----------
1644
+ radii : tuple with floats
1645
+ The radii for the radial gridlines
1646
1646
1647
- *labels*, if not *None*, is a len(*radii*) list of strings of the
1648
- labels to use at each angle.
1647
+ labels : tuple with strings or None
1648
+ The labels to use at each radial gridline. The
1649
+ `matplotlib.ticker.ScalarFormatter` will be used if None.
1649
1650
1650
- If *labels* is None, the rformatter will be used
1651
+ angle : float
1652
+ The angular position of the radius labels in degrees.
1651
1653
1652
- Examples::
1654
+ fmt : str or None
1655
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
1656
+ For example '%f'.
1653
1657
1654
- # set the locations of the radial gridlines and labels
1658
+ Returns
1659
+ -------
1660
+ lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1661
+ *lines* are the radial gridlines and *labels* are the tick labels.
1662
+
1663
+ Other Parameters
1664
+ ----------------
1665
+ **kwargs
1666
+ *kwargs* are optional `~.Text` properties for the labels.
1667
+
1668
+ Examples
1669
+ --------
1670
+ ::
1671
+
1672
+ # set the locations of the radial gridlines
1655
1673
lines, labels = rgrids( (0.25, 0.5, 1.0) )
1656
1674
1657
- # set the locations and labels of the radial gridlines and labels
1658
- lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' )
1675
+ # set the locations and labels of the radial gridlines
1676
+ lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' ))
1677
+
1678
+ See Also
1679
+ --------
1680
+ .pyplot.thetagrids
1681
+ .projections.polar.PolarAxes.set_rgrids
1682
+ .Axis.get_gridlines
1683
+ .Axis.get_ticklabels
1684
+
1659
1685
1660
1686
"""
1661
1687
ax = gca ()
@@ -1670,57 +1696,62 @@ def rgrids(*args, **kwargs):
1670
1696
return ( silent_list ('Line2D rgridline' , lines ),
1671
1697
silent_list ('Text rgridlabel' , labels ) )
1672
1698
1673
-
1674
1699
def thetagrids (* args , ** kwargs ):
1675
1700
"""
1676
- Get or set the theta locations of the gridlines in a polar plot.
1701
+ Get or set the theta gridlines on the current polar plot.
1677
1702
1678
- If no arguments are passed, return a tuple (*lines*, *labels*)
1679
- where *lines* is an array of radial gridlines
1680
- (:class:`~matplotlib.lines.Line2D` instances) and *labels* is an
1681
- array of tick labels (:class:`~matplotlib.text.Text` instances)::
1682
-
1683
- lines, labels = thetagrids()
1684
-
1685
- Otherwise the syntax is::
1686
-
1687
- lines, labels = thetagrids(angles, labels=None, fmt='%d', frac = 1.1)
1688
-
1689
- set the angles at which to place the theta grids (these gridlines
1690
- are equal along the theta dimension).
1691
-
1692
- *angles* is in degrees.
1703
+ Call signatures::
1693
1704
1694
- *labels*, if not *None*, is a len(angles) list of strings of the
1695
- labels to use at each angle.
1705
+ lines, labels = thetagrids()
1706
+ lines, labels = thetagrids(angles, labels=None, fmt=None, **kwargs)
1696
1707
1697
- If *labels* is *None*, the labels will be ``fmt%angle``.
1708
+ When called with no arguments, `.thetagrids` simply returns the tuple
1709
+ (*lines*, *labels*). When called with arguments, the labels will
1710
+ appear at the specified angles.
1698
1711
1699
- *frac* is the fraction of the polar axes radius at which to place
1700
- the label (1 is the edge). e.g., 1.05 is outside the axes and 0.95
1701
- is inside the axes.
1712
+ Parameters
1713
+ ----------
1714
+ angles : tuple with floats, degrees
1715
+ The angles of the theta gridlines.
1702
1716
1703
- Return value is a list of tuples (*lines*, *labels*):
1717
+ labels : tuple with strings or None
1718
+ The labels to use at each radial gridline. The
1719
+ `.projections.polar.ThetaFormatter` will be used if None.
1704
1720
1705
- - *lines* are :class:`~matplotlib.lines.Line2D` instances
1721
+ fmt : str or None
1722
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
1723
+ For example '%f'. Note that the angle in radians will be used.
1706
1724
1707
- - *labels* are :class:`~matplotlib.text.Text` instances.
1725
+ Returns
1726
+ -------
1727
+ lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1728
+ *lines* are the theta gridlines and *labels* are the tick labels.
1708
1729
1709
- Note that on input, the *labels* argument is a list of strings,
1710
- and on output it is a list of :class:`~matplotlib.text.Text`
1711
- instances.
1730
+ Other Parameters
1731
+ ----------------
1732
+ **kwargs
1733
+ *kwargs* are optional `~.Text` properties for the labels.
1712
1734
1713
- Examples::
1735
+ Examples
1736
+ --------
1737
+ ::
1714
1738
1715
- # set the locations of the radial gridlines and labels
1739
+ # set the locations of the angular gridlines
1716
1740
lines, labels = thetagrids( range(45,360,90) )
1717
1741
1718
- # set the locations and labels of the radial gridlines and labels
1742
+ # set the locations and labels of the angular gridlines
1719
1743
lines, labels = thetagrids( range(45,360,90), ('NE', 'NW', 'SW','SE') )
1744
+
1745
+ See Also
1746
+ --------
1747
+ .pyplot.rgrids
1748
+ .projections.polar.PolarAxes.set_thetagrids
1749
+ .Axis.get_gridlines
1750
+ .Axis.get_ticklabels
1720
1751
"""
1721
1752
ax = gca ()
1722
1753
if not isinstance (ax , PolarAxes ):
1723
- raise RuntimeError ('rgrids only defined for polar axes' )
1754
+ raise RuntimeError ('thetagrids only defined for polar axes' )
1724
1755
if len (args )== 0 :
1725
1756
lines = ax .xaxis .get_ticklines ()
1726
1757
labels = ax .xaxis .get_ticklabels ()
0 commit comments