我有一些数据已经用python读入numpy数组,每个数组的长度是22500个数据点。我试图用下面的代码创建一个彩色图,但它不起作用。如果有人能给我一些关于我做错了什么的建议,我将不胜感激。在
# - The code starts out with lines which read data from a text file into three separate
# python lists. However, these lines are not necessary for this example so they are
# being omitted.
# These lines transform the lists into numpy arrays. Each array contains 22,500 data points
XVal = np.array(Array1)
YVal = np.array(Array2)
ZVal = np.array(Array3)
# - These section attempts to create a 2D color map of the data with the XVal and ZVal arrays
# being represented as x and y coordinates on the color map and the ZVal array represented
# as a color on the X and Y coordinates
import pylab
# Create the colormap
pylab.pcolor(XVal,YVal,ZVal)
# Create colorbar
pylab.colorbar()
# Show plot on screen
pylab.show()
当我运行这段代码时,我得到以下冗长的错误消息
^{pr2}$
为了完成,我添加了正确的代码行来解决我的问题。对于如此大的数据集,它需要imshow和覆盖数据的网格,这需要在原始X、Y、Z坐标和网格网格X、Y、Z坐标之间进行插值。在
相关问题 更多 >
编程相关推荐