简体   繁体   English

无法使用Matplotlib 3D绘制线框

[英]Not able to plot wireframe with matplotlib 3d

I am trying following code from https://pythonprogramming.net/3d-graphing-python-matplotlib/ 我正在尝试遵循https://pythonprogramming.net/3d-graphing-python-matplotlib/中的代码

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
X, Y, Z = [1,2,3,4,5,6,7,8,9,10],[5,6,2,3,13,4,1,2,4,8],[2,3,3,3,5,7,9,11,9,10]
ax.plot_wireframe(X, Y, Z)

plt.show() 

However, I am getting following error: 但是,我得到以下错误:

AttributeError: 'list' object has no attribute 'ndim'

I have tried converting list to np.array but still the error persists. 我尝试将列表转换为np.array但错误仍然存​​在。 Where is the problem? 问题出在哪儿?

只是一些库版本兼容性问题,请尝试将ax.plot_wireframe(X, Y, Z)更改为ax.plot(X, Y, Z)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM