本文簡要介紹 python 語言中 matplotlib.pyplot.axis
的用法。
-
獲取或設置某些軸屬性的便捷方法。
調用簽名:
xmin, xmax, ymin, ymax = axis() xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax]) xmin, xmax, ymin, ymax = axis(option) xmin, xmax, ymin, ymax = axis(**kwargs)
- 參數:
- xmin, xmax, ymin, ymax 浮點數,可選
-
要設置的軸限製。這也可以使用
ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
- option 布爾或字符串
-
如果是布爾值,則打開或關閉軸線和標簽。如果是字符串,可能的值為:
值
說明
'off'或
False
隱藏所有軸裝飾,即軸標簽、書脊、刻度線、刻度標簽和網格線。這與
set_axis_off()
相同。'on'或
True
不要隱藏所有軸裝飾,即軸標簽、書脊、刻度線、刻度標簽和網格線。這與
set_axis_on()
相同。'equal'
通過更改軸限製來設置相等的縮放比例(即,使圓變成圓形)。這與
ax.set_aspect('equal', adjustable='datalim')
相同。在這種情況下,可能不會遵守明確的數據限製。'scaled'
通過更改繪圖框的尺寸來設置相等的縮放比例(即,使圓圈成為圓形)。這與
ax.set_aspect('equal', adjustable='box', anchor='C')
.此外,將禁用進一步的自動縮放。'tight'
設置足夠大的限製以顯示所有數據,然後禁用進一步的自動縮放。
'auto'
自動縮放(用數據填充繪圖框)。
'image'
'scaled' 軸限製等於數據限製。
'square'
方地塊;類似於 'scaled',但最初強製
xmax-xmin == ymax-ymin
。 - emit 布爾值,默認值:真
- 返回:
- xmin, xmax, ymin, ymax 浮點數
-
軸限製。
注意
對於 3D 軸,此方法另外采用
zmin
、zmax
作為參數,並同樣返回它們。
用法
matplotlib.pyplot.axis(arg=None, /, *, emit=True, **kwargs)
相關用法
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib axline用法及代碼示例
- Python matplotlib axes用法及代碼示例
- Python matplotlib arrow用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.pyplot.axis。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。