我正在尝试从保存在.dat文件中的数据制作直方图:我已经制作了其他类型的图,但在尝试使直方图时我收到错误:ValueError:x只有一个数据点。必须给出垃圾箱或范围kwarg。 该表肯定有(多个)多个数据点! 代码如下......
Repeater rpt = ((Theme)Page.Master).FindControl("Navigation").FindControl("rpt_NavItem") as Repeater;
Literal lit = rpt.FindControl("lit_NavActive");
if (lit != null) { lit.Visible = false; }
当我要求打印w1时,它会打印所有值。所有数字都是浮点数 - 这会有所不同吗? 感谢...
答案 0 :(得分:1)
从这看起来,你试图用第一行绘制直方图:
for line in a:
...
n, bins, patches = plt.hist(w1, 20, normed=1, histtype='bar', rwidth=0.8)
要制作直方图,您需要传递所有数据,而不是一次传递一个数据。
我建议您也使用genfromtxt
,您可以使用以下内容:
a = np.genfromtxt('/24_5_15b.dat') # delimiter is " " by default
w1 = a[:,13]
w2 = a[:,15]
plt.hist(w1, ...)