matplotlib.pyplot.thetagrids#

matplotlib.pyplot.thetagrids(angles=None, labels=None, fmt=None, **kwargs)[source]#

获取或设置当前极坐标图上的 theta 网格线。

调用签名

lines, labels = thetagrids()
lines, labels = thetagrids(angles, labels=None, fmt=None, **kwargs)

当不带参数调用时,thetagrids 仅返回元组 (lines, labels)。当带参数调用时,标签将出现在指定的角度处。

参数:
angles浮点数元组,单位为度

theta 网格线的角度。

labels字符串元组或 None

在每个径向网格线上使用的标签。如果为 None,将使用 projections.polar.ThetaFormatter

fmt字符串或 None

用于 matplotlib.ticker.FormatStrFormatter 的格式化字符串。例如 '%f'。注意,此处将使用弧度制角度。

返回:
lineslines.Line2D 列表

theta 网格线。

labels列表,包含 text.Text

刻度标签。

其他参数:
**kwargs

kwargs 是标签的可选 Text 属性。

示例

# set the locations of the angular gridlines
lines, labels = thetagrids(range(45, 360, 90))

# set the locations and labels of the angular gridlines
lines, labels = thetagrids(range(45, 360, 90), ('NE', 'NW', 'SW', 'SE'))