本文簡要介紹 python 語言中 matplotlib.pyplot.step
的用法。
-
製作階梯圖。
調用簽名:
step(x, y, [fmt], *, data=None, where='pre', **kwargs) step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
這隻是
plot
的一個薄包裝,它改變了一些格式選項。 plot的大部分概念和參數也可以在這裏使用。注意此方法使用帶有階梯繪製樣式的標準繪圖:
x
值是參考位置,階梯向左/右/兩個方向延伸,具體取決於where
。對於您知道步驟的值和邊的常見情況,請改用
stairs
。- 參數:
- x 類數組
-
x 位置的一維序列。假設但未經檢查,它是均勻增加的。
- y 類數組
-
y 水平的一維序列。
- fmt str,可選
-
格式字符串,例如'g' 為綠線。有關更詳細的說明,請參閱
plot
。注意:雖然接受完整格式的字符串,但建議僅指定顏色。當前忽略線型(改用關鍵字參數
linestyle
)。標記被接受並繪製在給定的位置上,但是,這是階梯圖很少需要的函數。 - where {'pre', 'post', 'mid'},默認:'pre'
-
定義應放置步驟的位置:
-
'pre':y 值從每個
x
位置一直向左連續,即區間(x[i-1], x[i]]
的值為y[i]
。 -
'post':y 值從每個
x
位置不斷向右延伸,即區間[x[i], x[i+1])
的值為y[i]
。 -
'mid':在
x
位置之間出現步驟 half-way。
-
- data 可索引對象,可選
-
帶有標簽數據的對象。如果給定,請提供要在
x
和y
中繪製的標簽名稱。 - **kwargs
-
附加參數與
plot
相同。
- 返回:
-
Line2D
列表 -
表示繪製數據的對象。
-
用法
matplotlib.pyplot.step(x, y, *args, where='pre', data=None, **kwargs)
相關用法
- Python matplotlib subplots用法及代碼示例
- Python matplotlib silent_list用法及代碼示例
- Python matplotlib subplot2grid用法及代碼示例
- Python matplotlib subplot用法及代碼示例
- Python matplotlib select_matching_signature用法及代碼示例
- Python matplotlib semilogx用法及代碼示例
- Python matplotlib semilogy用法及代碼示例
- Python matplotlib savefig用法及代碼示例
- 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 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用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.pyplot.step。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。