我是新的python。我想生成这些线,我从3D数组中获得。如何使用Matplotlib制作简单的3D线?
下面是代码:
VecStart_x = [0,1,3,5]
VecStart_y = [2,2,5,5]
VecStart_z = [0,1,1,5]
VecEnd_x = [1,2,-1,6]
VecEnd_y = [3,1,-2,7]
VecEnd_z =[1,0,4,9]
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([VecStart_x ,VecEnd_x],[VecStart_y,VecEnd_y],[VecStart_z,VecEnd_z])
plt.show()
Axes3D.plot()
我百达得到这个错误:
ValueError异常:第三个参数必须是一个格式字符串
我感谢你的帮助。
修复它。谢谢。 – 2012-07-18 12:45:13