本文簡要介紹 python 語言中 matplotlib.pyplot.xticks
的用法。
-
獲取或設置 x 軸的當前刻度位置和標簽。
不傳遞任何參數以返回當前值而不修改它們。
- 參數:
- ticks 類似數組,可選
-
xtick 位置列表。傳遞一個空列表會刪除所有 xticks。
- labels 類似數組,可選
-
要放置在給定
ticks
位置的標簽。僅當ticks
也被傳遞時,才能傳遞此參數。 - minor 布爾值,默認值:假
-
如果是
False
,獲取/設置主要刻度/標簽;如果是True
,則為次要刻度/標簽。 - **kwargs
-
Text
屬性可用於控製標簽的外觀。
- 返回:
- 位置
-
xtick 位置列表。
- 標簽
-
xlabel
Text
對象的列表。
注意
不帶參數調用此函數(例如
xticks()
)相當於在當前軸上調用get_xticks
和get_xticklabels
的 pyplot。使用參數調用此函數相當於在當前軸上調用set_xticks
和set_xticklabels
的 pyplot。例子
>>> locs, labels = xticks() # Get the current locations and labels. >>> xticks(np.arange(0, 1, step=0.2)) # Set label locations. >>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels. >>> xticks([0, 1, 2], ['January', 'February', 'March'], ... rotation=20) # Set text labels and properties. >>> xticks([]) # Disable xticks.
用法
matplotlib.pyplot.xticks(ticks=None, labels=None, *, minor=False, **kwargs)
相關用法
- Python matplotlib xlim用法及代碼示例
- Python matplotlib xkcd用法及代碼示例
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib triplot用法及代碼示例
- Python matplotlib StarPolygonCollection.set_hatch用法及代碼示例
- Python matplotlib Axes.hist用法及代碼示例
- Python matplotlib boxplot用法及代碼示例
- Python matplotlib subplots用法及代碼示例
- Python matplotlib InsetPosition用法及代碼示例
- Python matplotlib ToolManager.toolmanager_disconnect用法及代碼示例
- Python matplotlib Figure.set_size_inches用法及代碼示例
- Python matplotlib figlegend用法及代碼示例
- Python matplotlib Axes.step用法及代碼示例
- Python matplotlib Axes.contour用法及代碼示例
- Python matplotlib LassoSelector用法及代碼示例
- Python matplotlib BrokenBarHCollection.set_hatch用法及代碼示例
- Python matplotlib Axes.plot用法及代碼示例
- Python matplotlib Axes.semilogx用法及代碼示例
- Python matplotlib Axes.semilogy用法及代碼示例
- Python matplotlib MovieWriterRegistry.register用法及代碼示例
- Python matplotlib PolyQuadMesh.set_hatch用法及代碼示例
- Python matplotlib warn_deprecated用法及代碼示例
- Python matplotlib Text.set_bbox用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.pyplot.xticks。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。