エラーバーしたい(matplotlib.pyplot.errorbar
)
1import matplotlib.pyplot as plt
2
3x_data = data["x"]
4y_data = data["y"]
5y_error = data["y_error"]
6
7fig, ax = plt.subplots()
8ax.errorbar(
9 x=x_data,
10 y=y_data,
11 yerr=y_error,
12 )
13
14plt.show()
Axes.errorbarで、エラーバー付の散布図を作成できます。
エラーの大きさxerr
、yerr
オプションで設定できます。
大きさはあらかじめデータフレームで計算しておくとよいでしょう。