2016-05-31 33 views
-3

如何使用这组数据并使用pcolormesh对其进行绘图?数据如下:如何用一组数据的均值创建pcolormesh?

array([[ 0.  ,  0.  ,  0.  , ..., 
     0.  ,  0.  ,  0.  ], 
    [ 34.19227552, 34.19246389, 34.19265956, ..., 
     34.19284295, 34.19253446, 34.1923012 ], 
    [ 68.46819899, 68.46861825, 68.46892983, ..., 
     68.46895204, 68.46856004, 68.46812476], 
    ..., 
    [ 3937.42832088, 3937.42522049, 3937.43673897, ..., 
    3937.43603929, 3937.44434961, 3937.43535423], 
    [ 3987.08591207, 3987.082997 , 3987.09487184, ..., 
    3987.09300137, 3987.10157045, 3987.09271431], 
    [ 4037.00035477, 4036.9977684 , 4037.01006508, ..., 
    4037.00674248, 4037.01561165, 4037.00689316]]) 

我需要将这些数据绘制成一个3D pcolormesh matplotlib。我该怎么做呢?如果任何人都可以帮助我,我会非常感激,因为我真的需要帮助。

回答

0

也许你可以按照这个turorials:

http://matplotlib.org/examples/pylab_examples/pcolor_demo.html

http://mlpy.sourceforge.net/docs/3.3/tutorial.html

加载模块:

>>> import numpy as np 
>>> import mlpy 
>>> import matplotlib.pyplot as plt # required for plotting 

装入虹膜数据集:

>>> iris = np.loadtxt('iris.csv', delimiter=',') 
>>> x, y = iris[:, :4], iris[:, 4].astype(np.int) # x: (observations x attributes) matrix, y: classes (1: setosa, 2: versicolor, 3: virginica) 
>>> x.shape 
(150, 4) 
>>> y.shape 
(150,) 
+0

我试过了,但我一直在收到错误,说数据太大。任何想法如何解决这个问题? –

+0

现在它告诉我,没有名为mlpy的模块!它是一个模块,我必须通过命令提示符下载? –

+0

是的,你必须安装它。关注此:http://mlpy.sourceforge.net/docs/3.5/install.html – Destrif

相关问题