Python Quiver Plot Without Head
I'd like to make a quiver plot without the heads of the arrows. I also want to have borders so that the arrows could stand out of the background color plot. Here is the main part o
Solution 1:
Specifying the headaxislength parameter for the arrows to be zero does the trick:
import numpy as np
import matplotlib.pyplot as plt
theta = np.linspace(0, 2*np.pi, 16)
r = np.linspace(0, 1, 6)
x = np.cos(theta)[:,np.newaxis]*r
y = np.sin(theta)[:,np.newaxis]*r
quiveropts = dict(color='white', headlength=0, pivot='middle', scale=3,
linewidth=.5, units='xy', width=.05, headwidth=1) # common options
f, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True)
ax1.quiver(x,y, -y, x, headaxislength=4.5, **quiveropts) # the default
ax2.quiver(x,y, -y, x, headaxislength=0, **quiveropts)
The code above results in the following quiverplots, without arrowheads.

Post a Comment for "Python Quiver Plot Without Head"