How to plot vectors in python using matplotlib

后端 未结 6 723
太阳男子
太阳男子 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条回答
  •  悲&欢浪女
    2020-12-24 03:37

    All nice solutions, borrowing and improvising for special case -> If you want to add a label near the arrowhead:

    
        arr = [2,3]
        txt = “Vector X”
        ax.annotate(txt, arr)
        ax.arrow(0, 0, *arr, head_width=0.05, head_length=0.1)
    
    

提交回复
热议问题