小编Dan*_*jic的帖子

如何使用Matplotlib制作简单的3D线?

我想生成线条,这是我从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()
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

ValueError:第三个arg必须是格式字符串

python matplotlib

21
推荐指数
2
解决办法
4万
查看次数

标签 统计

matplotlib ×1

python ×1