2017-05-07 34 views
1

我有一堆數據,我需要以一些可以理解的方式看到。這裏是我到目前爲止已經完成:將數據繪製爲從2D到3D的蟒蛇

.................................. 
features = [] 
for i in range(len(variance_list[0][:])): 
    for j in range(len(variance_list)): 
     features.append(variance_list[j][i]) 

    plt.plot(features) 
    features.clear() 
plt.xlabel('classes ') 
plt.ylabel('features') 
plt.show() 

結果看起來如下:

enter image description here

所以我試圖在3D繪製該如下:

for i in range(len(variance_list[0][:])): 
    for j in range(len(variance_list)): 
     Axes3D.plot(i,j,variance_list[j][i],label='parametric curve') 
plt.show() 

我收到以下錯誤信息:

 1510   #  many other traditional positional arguments occur 
    1511   #  such as the color, linestyle and/or marker. 
-> 1512   had_data = self.has_data() 
    1513   zs = kwargs.pop('zs', 0) 
    1514   zdir = kwargs.pop('zdir', 'z') 

AttributeError: 'int' object has no attribute 'has_data' 

任何想法,我缺少的,或者我如何可以解決這個

回答

1

除了宇宙的建議,

fig = plt.figure() 
ax = fig.gca(projection='3d') 
ax.plot(...) 

,有在X的差值,Y線以及z VAR

variance_list=[[np.random.rand()**2*(j+1) for _ in range(10)] for j in range(4)] 

fig = plt.figure() 
ax = fig.gca(projection='3d') 
for j in range(len(variance_list)): 
    ax.plot(range(len(variance_list[0])),variance_list[j],j,label='parametric curve') 
plt.show() 

enter image description here