@@ -1531,36 +1531,62 @@ def yticks(ticks=None, labels=None, **kwargs):
1531
1531
1532
1532
return locs , silent_list ('Text yticklabel' , labels )
1533
1533
1534
-
1535
1534
def rgrids (* args , ** kwargs ):
1536
1535
"""
1537
- Get or set the radial gridlines on a polar plot.
1536
+ Get or set the radial gridlines on the current polar plot.
1537
+
1538
+ Call signatures::
1539
+
1540
+ lines, labels = rgrids()
1541
+ lines, labels = rgrids(radii, labels=None, angle=22.5, fmt=None, **kwargs)
1542
+
1543
+ When called with no arguments, `.rgrids` simply returns the tuple
1544
+ (*lines*, *labels*). When called with arguments, the labels will
1545
+ appear at the specified radial distances and angle.
1538
1546
1539
- call signatures::
1547
+ Parameters
1548
+ ----------
1549
+ radii : tuple with floats
1550
+ The radii for the radial gridlines
1551
+
1552
+ labels : tuple with strings or None
1553
+ The labels to use at each radial gridline. The
1554
+ `matplotlib.ticker.ScalarFormatter` will be used if None.
1540
1555
1541
- lines, labels = rgrids()
1542
- lines, labels = rgrids(radii, labels=None, angle=22.5, **kwargs)
1556
+ angle : float
1557
+ The angular position of the radius labels in degrees.
1543
1558
1544
- When called with no arguments, :func:`rgrid` simply returns the
1545
- tuple (*lines*, *labels*), where *lines* is an array of radial
1546
- gridlines (:class:`~matplotlib.lines.Line2D` instances) and
1547
- *labels* is an array of tick labels
1548
- (:class:`~matplotlib.text.Text` instances). When called with
1549
- arguments, the labels will appear at the specified radial
1550
- distances and angles.
1559
+ fmt : str or None
1560
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
1561
+ For example '%f'.
1551
1562
1552
- *labels*, if not *None*, is a len(*radii*) list of strings of the
1553
- labels to use at each angle.
1563
+ Returns
1564
+ -------
1565
+ lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1566
+ *lines* are the radial gridlines and *labels* are the tick labels.
1554
1567
1555
- If *labels* is None, the rformatter will be used
1568
+ Other Parameters
1569
+ ----------------
1570
+ **kwargs
1571
+ *kwargs* are optional `~.Text` properties for the labels.
1556
1572
1557
- Examples::
1573
+ Examples
1574
+ --------
1575
+ ::
1558
1576
1559
- # set the locations of the radial gridlines and labels
1577
+ # set the locations of the radial gridlines
1560
1578
lines, labels = rgrids( (0.25, 0.5, 1.0) )
1561
1579
1562
- # set the locations and labels of the radial gridlines and labels
1563
- lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' )
1580
+ # set the locations and labels of the radial gridlines
1581
+ lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' ))
1582
+
1583
+ See Also
1584
+ --------
1585
+ .pyplot.thetagrids
1586
+ .projections.polar.PolarAxes.set_rgrids
1587
+ .Axis.get_gridlines
1588
+ .Axis.get_ticklabels
1589
+
1564
1590
1565
1591
"""
1566
1592
ax = gca ()
@@ -1575,57 +1601,62 @@ def rgrids(*args, **kwargs):
1575
1601
return ( silent_list ('Line2D rgridline' , lines ),
1576
1602
silent_list ('Text rgridlabel' , labels ) )
1577
1603
1578
-
1579
1604
def thetagrids (* args , ** kwargs ):
1580
1605
"""
1581
- Get or set the theta locations of the gridlines in a polar plot.
1606
+ Get or set the theta gridlines on the current polar plot.
1582
1607
1583
- If no arguments are passed, return a tuple (*lines*, *labels*)
1584
- where *lines* is an array of radial gridlines
1585
- (:class:`~matplotlib.lines.Line2D` instances) and *labels* is an
1586
- array of tick labels (:class:`~matplotlib.text.Text` instances)::
1587
-
1588
- lines, labels = thetagrids()
1589
-
1590
- Otherwise the syntax is::
1591
-
1592
- lines, labels = thetagrids(angles, labels=None, fmt='%d', frac = 1.1)
1593
-
1594
- set the angles at which to place the theta grids (these gridlines
1595
- are equal along the theta dimension).
1596
-
1597
- *angles* is in degrees.
1608
+ Call signatures::
1598
1609
1599
- *labels*, if not *None*, is a len(angles) list of strings of the
1600
- labels to use at each angle.
1610
+ lines, labels = thetagrids()
1611
+ lines, labels = thetagrids(angles, labels=None, fmt=None, **kwargs)
1601
1612
1602
- If *labels* is *None*, the labels will be ``fmt%angle``.
1613
+ When called with no arguments, `.thetagrids` simply returns the tuple
1614
+ (*lines*, *labels*). When called with arguments, the labels will
1615
+ appear at the specified angles.
1603
1616
1604
- *frac* is the fraction of the polar axes radius at which to place
1605
- the label (1 is the edge). e.g., 1.05 is outside the axes and 0.95
1606
- is inside the axes.
1617
+ Parameters
1618
+ ----------
1619
+ angles : tuple with floats, degrees
1620
+ The angles of the theta gridlines.
1607
1621
1608
- Return value is a list of tuples (*lines*, *labels*):
1622
+ labels : tuple with strings or None
1623
+ The labels to use at each radial gridline. The
1624
+ `.projections.polar.ThetaFormatter` will be used if None.
1609
1625
1610
- - *lines* are :class:`~matplotlib.lines.Line2D` instances
1626
+ fmt : str or None
1627
+ Format string used in `matplotlib.ticker.FormatStrFormatter`.
1628
+ For example '%f'. Note that the angle in radians will be used.
1611
1629
1612
- - *labels* are :class:`~matplotlib.text.Text` instances.
1630
+ Returns
1631
+ -------
1632
+ lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1633
+ *lines* are the theta gridlines and *labels* are the tick labels.
1613
1634
1614
- Note that on input, the *labels* argument is a list of strings,
1615
- and on output it is a list of :class:`~matplotlib.text.Text`
1616
- instances.
1635
+ Other Parameters
1636
+ ----------------
1637
+ **kwargs
1638
+ *kwargs* are optional `~.Text` properties for the labels.
1617
1639
1618
- Examples::
1640
+ Examples
1641
+ --------
1642
+ ::
1619
1643
1620
- # set the locations of the radial gridlines and labels
1644
+ # set the locations of the angular gridlines
1621
1645
lines, labels = thetagrids( range(45,360,90) )
1622
1646
1623
- # set the locations and labels of the radial gridlines and labels
1647
+ # set the locations and labels of the angular gridlines
1624
1648
lines, labels = thetagrids( range(45,360,90), ('NE', 'NW', 'SW','SE') )
1649
+
1650
+ See Also
1651
+ --------
1652
+ .pyplot.rgrids
1653
+ .projections.polar.PolarAxes.set_thetagrids
1654
+ .Axis.get_gridlines
1655
+ .Axis.get_ticklabels
1625
1656
"""
1626
1657
ax = gca ()
1627
1658
if not isinstance (ax , PolarAxes ):
1628
- raise RuntimeError ('rgrids only defined for polar axes' )
1659
+ raise RuntimeError ('thetagrids only defined for polar axes' )
1629
1660
if len (args )== 0 :
1630
1661
lines = ax .xaxis .get_ticklines ()
1631
1662
labels = ax .xaxis .get_ticklabels ()
0 commit comments