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'。请注意,将使用弧度角。

返回:
lines lines.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'))