當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python matplotlib thetagrids用法及代碼示例

本文簡要介紹 python 語言中 matplotlib.pyplot.thetagrids 的用法。

用法

matplotlib.pyplot.thetagrids(angles=None, labels=None, fmt=None, **kwargs)

獲取或設置當前極坐標圖上的 theta 網格線。

調用簽名:

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

當不帶參數調用時, thetagrids 僅返回元組( lineslabels )。當使用參數調用時,標簽將以指定的角度出現。

參數
angles 帶浮點數、度數的元組

theta 網格線的角度。

labels 帶字符串或無的元組

在每個徑向網格線上使用的標簽。如果沒有,將使用 projections.polar.ThetaFormatter

fmt str 或 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'))

相關用法


注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.pyplot.thetagrids。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。