[英]how to plot y-axis points between specific intervals of x-axis?
I have x and y values.我有 x 和 y 值。 The x-axis values lie between 65 to 79, which are divided into three bins ie, 65-69, 70-74, 75-80.
x 轴值介于 65 到 79 之间,分为三个 bin,即 65-69、70-74、75-80。 I have computed the mean and standard deviation for each bin.
我已经计算了每个 bin 的平均值和标准差。 The data is shown in the figure.
数据如图所示。
I want to plot the mean and std as error bars in the respective bin of the x-axis.我想在 x 轴的相应 bin 中将平均值和标准绘制为误差线。 The resultant plot is also shown in the following figure.
结果图也显示在下图中。 Please if anyone knows, can help me.
请如果有人知道,可以帮助我。
Perhaps something like this ?也许是这样的?
import matplotlib.pyplot as plt
xValues = [67, 72, 77]
yValues = [67, 72, 77]
xErrorValues = [1.6, 1.6, 1.6]
yErrorValues = [1.6, 1.6, 1.6]
plt.scatter(xValues, yValues, zorder = 2)
plt.errorbar(xValues, yValues, xerr = xErrorValues, yerr = yErrorValues,
fmt = 'none', capsize = 10, ecolor = 'red', zorder = 1)
plt.xlim(60, 90)
plt.ylim(60, 90)
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.