擅长:python、mysql、java
<p>我做了两件事来解决这个问题。</p>
<ol>
<li>将numpy导入为np</li>
<li>使z轴成为多维数组</li>
</ol>
<p/><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">&13;
<div class="snippet-code">&13;
<pre class="snippet-code-html lang-html prettyprint-override"><code>#My 3d graph
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import numpy as np
figure = plt.figure()
axis = figure.add_subplot(111, projection = '3d')
x = [1,2,3,4,5,6,7,8,9,10]
y = [5,6,7,8,2,5,6,3,7,2]
z = np.array([[1,2,6,3,2,7,3,3,7,2],[1,2,6,3,2,7,3,3,7,2]])
axis.plot_wireframe(x, y, z)
axis.set_xlabel('x-axis')
axis.set_ylabel('y-axis')
axis.set_zlabel('z-axis')
plt.show()</code></pre>
;
</div>
;
</div>
;
<blockquote>
<p>Take special note of the z variable. If z is not multidimensional, it will throw an error.</p>
</blockquote>
<p><strong>希望它能解决您的问题</strong></p>