How to plot vectors in python using matplotlib

后端 未结 6 695
太阳男子
太阳男子 2020-12-24 03:30

I am taking a course on linear algebra and I want to visualize the vectors in action, such as vector addition, normal vector, so on.

For instance:

         


        
6条回答
  •  Happy的楠姐
    2020-12-24 03:50

    This may also be achieved using matplotlib.pyplot.quiver, as noted in the linked answer;

    plt.quiver([0, 0, 0], [0, 0, 0], [1, -2, 4], [1, 2, -7], angles='xy', scale_units='xy', scale=1)
    plt.xlim(-10, 10)
    plt.ylim(-10, 10)
    plt.show()
    

提交回复
热议问题