I am trying to plot vectors using the quiver API in matplotlib.
I'm scratching my head because I am noticing the arrow tips don't end where they are supposed to.
For example, if I'm trying to plot a simple vector [2, 1], this is what I get.
Notice that the arrow is pointing a little past 2.0 in the x-direction and a little short of 1.0 in the y-direction.
Is this just an imperfection with the rendering? Or am I scaling something incorrectly?
Here is my code:
# Import libraries
import numpy as np
import matplotlib.pyplot as plt
# Vector origin location
X = [0]
Y = [0]
# Directional vectors
U = [2]
V = [1]
# Creating plot
plt.quiver(X, Y, U, V, color='b', units='xy', scale=1)
plt.title('Single Vector')
# x-lim and y-lim
plt.xlim(-2, 5)
plt.ylim(-2, 2.5)
# Show plot with gird
plt.grid()
plt.show()
UPDATE
I am using PyCharm as my environment. I noticed that when I resize the window the arrow tip moves. Could this be my problem? How do I anchor this down?



