Home > OS >  fill color between arrowheads in a quiver plot
fill color between arrowheads in a quiver plot

Time:12-17

I'm plotting a few arrows in a quiver plot, and I wonder if there is a way to fill the shape traced between the arrowheads with color. The quiver plots look like this:

import numpy as np
import matplotlib.pyplot as plt

theta = np.linspace( 0 , 2 * np.pi , 40 ) 
R = 5.0
x = R * np.cos( theta ) 
y = R * np.sin( theta ) 
m2_x = 9.0
m2_y = 9.0
u = -(x - m2_x)/((m2_x - x)**2   (m2_y - y)**2)**2 
v = -(y - m2_y)/((m2_x - x)**2   (m2_y - y)**2)**2 

fig, ax = plt.subplots(figsize=(7,7))
ax.quiver(x,y,u,v, headwidth=2, headlength=5, width=0.005)
ax.set_xlim((-20,20))
ax.set_ylim((-20,20))

I want to fill the circle-ish shape traced by the arrow heads with color, or at least connect the arrowheads with a line. Seems like it should be simple but I couldn't find how yet.

CodePudding user response:

quiver returns a enter image description here

  • Related