Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib parameter 'edgecolor' does not work with quiver?

The matplotlib.axes.Axes.quiver docs state that:

Arrow outline

linewidths and edgecolors can be used to customize the arrow outlines

However, a simple test code shows that edgecolor apparently does nothing. Am I missing something?

import matplotlib.pyplot as plt
import numpy as np

X = np.arange(-3, 3, 1)
Y = np.arange(-3, 3, 1)
U, V = np.meshgrid(X, Y)

plt.quiver(X, Y, U, V, edgecolor='r')
plt.show()

enter image description here

like image 720
Gabriel Avatar asked May 23 '26 21:05

Gabriel


1 Answers

It seems linewidth parameter is set to 0 as default for plt.quiver. Adding some sort of value in the function call starts displaying the edges of arrows. I.e.:

import matplotlib.pyplot as plt
import numpy as np

X = np.arange(-3, 3, 1)
Y = np.arange(-3, 3, 1)
U, V = np.meshgrid(X, Y)

plt.quiver(X, Y, U, V, edgecolor='r', linewidth = 1)
plt.show()

Output:

enter image description here

like image 173
dm2 Avatar answered May 25 '26 09:05

dm2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!