3d图在python中给出一些错误

时间:2018-02-19 14:30:43

标签: python python-3.x matplotlib

所以,这里有一个python新手。我想要做的是将点绘制到3d平面上。虽然执行时会出现一些错误。

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

fig = plt.figure()

chart = fig.add_subplot(1,1,1,projection='3d')

X,Y,Z=[1,2,3,4,5,6,7,8],[2,5,3,8,9,5,6,1],[3,6,2,7,5,4,5,6]

chart.plot_wireframe(X,Y,Z)

plt.show()

输出:

Traceback (most recent call last):
  File "/home/nishantsikri/3d objects.py", line 10, in <module>
chart.plot_wireframe(X,Y,Z)
  File "/home/nishantsikri/.local/lib/python3.6/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 1834, in plot_wireframe
    if Z.ndim != 2:
AttributeError: 'list' object has no attribute 'ndim'

0 个答案:

没有答案