[英]how to plot a line chart with error values in matplotlib?
I have a time series stored in pandas DataFrame with columns low, average, and high. 我在pandas DataFrame中存储了一个时间序列,其中列的低,平均值和高。 Currently, I plot the average values as a line chart, but I would like to fill the area between low and high values with a color.
目前,我将平均值绘制为折线图,但我想用颜色填充低值和高值之间的区域。
I am hoping to create a chart that looks exactly like this 我希望创建一个看起来像这样的图表
I think it's something like: 我认为是这样的:
ax.fill_between(df.index, df.upper, df.lower, where= df.upper > df.lower,
facecolor='red', alpha=0.5, interpolate=True)
Where ax is your axis, df
is the DataFrame
and upper
and lower
the bounds. 其中Ax是你的轴,
df
是DataFrame
和upper
和lower
的边界。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.