简体   繁体   English

python plot 2d numpy array

[英]python plot 2d numpy array

I am having a bit of misunderstanding with numpy array I have a set of two data (m, error) which I would like to plot 我对numpy数组有点误解,我想绘制一组两个数据(m,错误)

I save them in the array like this as I catch them in the same loop (which is probably causing the issue) 我将它们保存在同一循环中,因此将它们保存在这样的数组中(这可能是导致问题的原因)

sum_error = np.append(m,error)

Then just simply trying to plot like this but it doesn't work as apparently this array is only of size 1 (with a tuple?) 然后只是简单地尝试像这样绘制,但它却无法正常工作,因为此数组显然只有大小1(带有元组?)

plt.scatter(x=sum_error[:, 0], y=sum_error[:, 1])

What is the correct way to proceed? 正确的处理方法是什么? should I really make two different arrays, one for m, one for error in order to plot them? 我是否真的应该制作两个不同的数组,一个用于m,一个用于错误,以便绘制它们?

Thanks 谢谢

正如在此线程上回答的那样,请尝试使用

np.vstack((m,error))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM