2016-04-21 95 views
1

當我改變(90,0)matplolib中的plot_surface的觀點時,zaxis不清晰,並且在這個圖中是無用的。我想生成與matlab相同的圖像,如下所示 matlab surf with view (0,90),with contour lines 我使用matplotlib函數imshow可以生成矩陣圖像,但圖像中沒有行(類似於contourplot行)。我怎麼能生成與plot_surface在python與(90,0),bu沒有zaxis的觀點的圖像? matplotlib with plot_surface,view(90,0),withou lines and zaxismatplotlib與隱藏的軸的表面圖

回答

0

您可以使用contourfmatplotlib

import matplotlib.pyplot as plt 
import numpy as np 

X, Y = np.meshgrid(range(100), range(100)) 
Z = X**2+Y**2 

plt.contourf(X, Y, Z, [i for i in np.linspace(Z.min(),Z.max(),30)]) 
plt.show() 

,這會導致:

Contourf matplotlib

+0

謝謝。這對我有很大的幫助。 –