![](/img/trans.png)
[英]Plotting shaded uncertainty region in line plot in matplotlib when data has NaNs
[英]How to render line plot with uncertainty in matplotlib
我想知道我是否可以使用 plot 繪制一張圖表,其中我使用 matplotlib 顯示了一系列最佳和最差結果。結果應該如下所示:
您是否看到每個點周圍的范圍指定了最佳和最差的衡量標准是什么? 這正是我要找的。
我很確定錯誤欄 function 完全符合您的要求: https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.pyplot.errorbar.html
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.arange(10)
# yerr can be a single number or an array with same length as x and y
# depending on whether you want it to be constant or changing
yerr = 1
plt.errorbar(x, y, yerr=yerr)
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.