2016-03-19 5 views
0

Ich versuche, eine 3D-Oberfläche mit Koordinaten von x, y und Werten als w1 zu plotten. Ich habe die Abmessungen nach shape() überprüft, sie passen zusammen. aber ich erhalte den Fehler, dass "Attribut: 'Modul' Objekt hat kein Attribut 'plot_surface'"Python: AttributeError beim Zeichnen einer 3D-Oberfläche

Code:

import numpy as np 
import math 
import matplotlib.pyplot as plt 
from mpl_toolkits.mplot3d import Axes3D 

. . .

x = np.arange(xmin, xmax+dx, dx) 
z = np.arange(zmin, zmax+dz, dz) 
X, Z = np.meshgrid(x, z) 
#print X.shape, Z.shape, w1.shape 
plt.plot_surface(X, Z, w1) 
plt.show() 
+0

w1 zuvor definiert ist, und ist ein Array von Werten mit derselben Dimension wie X, Z ... Ich habe durch Form() – Soyol

Antwort

0

diese Weise ist es für mich gearbeitet:

fig = plt.figure() 
ax = fig.add_subplot(111, projection='3d') 

x = np.arange(xmin, xmax+dx, dx) 
z = np.arange(zmin, zmax+dz, dz) 
X, Z = np.meshgrid(x, z) 
ax.plot_surface(X, Z, w1) 
plt.show() 
Verwandte Themen