I want to plot a path (circle) in a vector field and calculate the work done on the path by the field (line integral). To visualise this, it is important to see which direction the circle path is going in. So I was wondering if there's a way to have arrows on the circle (at every 20 points for example) to show this?
The code follows:
import matplotlib.pyplot as plt
import numpy as np
t= np.linspace(0, 2*np.pi, 100)
x= np.cos(t)
y= np.sin(t)
X= Y = np.arange(-2,2,0.2)
X, Y = np.meshgrid(X,Y)
I = Y
J = -X
plt.figure()
plt.plot(x,y)
plt.quiver(X, Y, I, J)
plt.xlabel('x')
plt.ylabel('y')
plt.show()
I saw this picture on another question but the answer didn't work for me (and my reputation isn't high enough to comment or get help there)
link for the question: Arrow on a line plot with matplotlib
PS.
Python 3.6 and using the latest versions.