How can I make a simple 3D line with Matplotlib?

前端 未结 2 696
孤城傲影
孤城傲影 2020-12-29 20:37

I want to generate the lines, which I get from an array in 3D.

Here is the code:

VecStart_x = [0,1,3,5]
VecStart_y = [2,2,5,5]
VecStart_z = [0,1,1,5]         


        
2条回答
  •  生来不讨喜
    2020-12-29 21:06

    I guess, you want to plot 4 lines. Then you can try

    for i in range(4):
        ax.plot([VecStart_x[i], VecEnd_x[i]], [VecStart_y[i],VecEnd_y[i]],zs=[VecStart_z[i],VecEnd_z[i]])
    

    As @Nicolas have suggested, do have a look at the matplotlib gallery.

提交回复
热议问题