Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ab478a

Browse filesBrowse files
committed
doc_changes_thetagrids
1 parent 160d9f5 commit 5ab478a
Copy full SHA for 5ab478a

File tree

Expand file treeCollapse file tree

2 files changed

+138
-82
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+138
-82
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+55-30Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,27 +1221,39 @@ def set_rscale(self, *args, **kwargs):
12211221
def set_rticks(self, *args, **kwargs):
12221222
return Axes.set_yticks(self, *args, **kwargs)
12231223

1224-
@docstring.dedent_interpd
12251224
def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs):
12261225
"""
1227-
Set the angles at which to place the theta grids (these
1228-
gridlines are equal along the theta dimension). *angles* is in
1229-
degrees.
1226+
Set the theta gridlines in a polar plot.
12301227
1231-
*labels*, if not None, is a ``len(angles)`` list of strings of
1232-
the labels to use at each angle.
1233-
1234-
If *labels* is None, the labels will be ``fmt %% angle``
1235-
1236-
Return value is a list of tuples (*line*, *label*), where
1237-
*line* is :class:`~matplotlib.lines.Line2D` instances and the
1238-
*label* is :class:`~matplotlib.text.Text` instances.
1228+
Parameters
1229+
----------
1230+
angles : tuple with floats, degrees
1231+
The angles of the theta gridlines.
12391232
1240-
kwargs are optional text properties for the labels:
1233+
labels : tuple with strings or None
1234+
The labels to use at each theta gridline. The
1235+
`.projections.polar.ThetaFormatter` will be used if None.
12411236
1242-
%(Text)s
1237+
fmt : str or None
1238+
Format string used in `matplotlib.ticker.FormatStrFormatter`.
1239+
For example '%f'. Note that the angle that is used is in
1240+
radians.
12431241
1244-
ACCEPTS: sequence of floats
1242+
Returns
1243+
-------
1244+
lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1245+
*lines* are the theta gridlines and *labels* are the tick labels.
1246+
1247+
Other Parameters
1248+
----------------
1249+
**kwargs
1250+
*kwargs* are optional `~.Text` properties for the labels.
1251+
1252+
See Also
1253+
--------
1254+
.PolarAxes.set_rgrids
1255+
.Axis.get_gridlines
1256+
.Axis.get_ticklabels
12451257
"""
12461258

12471259
# Make sure we take into account unitized data
@@ -1256,29 +1268,42 @@ def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs):
12561268
t.update(kwargs)
12571269
return self.xaxis.get_ticklines(), self.xaxis.get_ticklabels()
12581270

1259-
@docstring.dedent_interpd
12601271
def set_rgrids(self, radii, labels=None, angle=None, fmt=None,
12611272
**kwargs):
12621273
"""
1263-
Set the radial locations and labels of the *r* grids.
1264-
1265-
The labels will appear at radial distances *radii* at the
1266-
given *angle* in degrees.
1274+
Set the radial gridlines on a polar plot.
12671275
1268-
*labels*, if not None, is a ``len(radii)`` list of strings of the
1269-
labels to use at each radius.
1270-
1271-
If *labels* is None, the built-in formatter will be used.
1276+
Parameters
1277+
----------
1278+
radii : tuple with floats
1279+
The radii for the radial gridlines
12721280
1273-
Return value is a list of tuples (*line*, *label*), where
1274-
*line* is :class:`~matplotlib.lines.Line2D` instances and the
1275-
*label* is :class:`~matplotlib.text.Text` instances.
1281+
labels : tuple with strings or None
1282+
The labels to use at each radial gridline. The
1283+
`matplotlib.ticker.ScalarFormatter` will be used if None.
12761284
1277-
kwargs are optional text properties for the labels:
1285+
angle : float
1286+
The angular position of the radius labels in degrees.
12781287
1279-
%(Text)s
1288+
fmt : str or None
1289+
Format string used in `matplotlib.ticker.FormatStrFormatter`.
1290+
For example '%f'.
12801291
1281-
ACCEPTS: sequence of floats
1292+
Returns
1293+
-------
1294+
lines, labels : list of `.lines.Line2D`, list of `.text.Text`
1295+
*lines* are the radial gridlines and *labels* are the tick labels.
1296+
1297+
Other Parameters
1298+
----------------
1299+
**kwargs
1300+
*kwargs* are optional `~.Text` properties for the labels.
1301+
1302+
See Also
1303+
--------
1304+
.PolarAxes.set_thetagrids
1305+
.Axis.get_gridlines
1306+
.Axis.get_ticklabels
12821307
"""
12831308
# Make sure we take into account unitized data
12841309
radii = self.convert_xunits(radii)

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+83-52Lines changed: 83 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,36 +1531,62 @@ def yticks(ticks=None, labels=None, **kwargs):
15311531

15321532
return locs, silent_list('Text yticklabel', labels)
15331533

1534-
15351534
def rgrids(*args, **kwargs):
15361535
"""
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.
15381546
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.
15401555
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.
15431558
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'.
15511562
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.
15541567
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.
15561572
1557-
Examples::
1573+
Examples
1574+
--------
1575+
::
15581576
1559-
# set the locations of the radial gridlines and labels
1577+
# set the locations of the radial gridlines
15601578
lines, labels = rgrids( (0.25, 0.5, 1.0) )
15611579
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+
15641590
15651591
"""
15661592
ax = gca()
@@ -1575,57 +1601,62 @@ def rgrids(*args, **kwargs):
15751601
return ( silent_list('Line2D rgridline', lines),
15761602
silent_list('Text rgridlabel', labels) )
15771603

1578-
15791604
def thetagrids(*args, **kwargs):
15801605
"""
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.
15821607
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::
15981609
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)
16011612
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.
16031616
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.
16071621
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.
16091625
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.
16111629
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.
16131634
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.
16171639
1618-
Examples::
1640+
Examples
1641+
--------
1642+
::
16191643
1620-
# set the locations of the radial gridlines and labels
1644+
# set the locations of the angular gridlines
16211645
lines, labels = thetagrids( range(45,360,90) )
16221646
1623-
# set the locations and labels of the radial gridlines and labels
1647+
# set the locations and labels of the angular gridlines
16241648
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
16251656
"""
16261657
ax = gca()
16271658
if not isinstance(ax, PolarAxes):
1628-
raise RuntimeError('rgrids only defined for polar axes')
1659+
raise RuntimeError('thetagrids only defined for polar axes')
16291660
if len(args)==0:
16301661
lines = ax.xaxis.get_ticklines()
16311662
labels = ax.xaxis.get_ticklabels()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.