Skip to content Skip to sidebar Skip to footer

How To Get An Open And Scaling Arrow Head In Matplotlib

In a Seaborn barplot, I want to annotate a column with an arrow. Now, while I see how this might seem a little discerning, I would really like that arrow to both have an open head

Solution 1:

The key is to use the overhang argument and set it to 1 or something close to it.

import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(4,4))

v = [-0.2, 0, .2, .4, .6, .8, 1]
for i, overhang inenumerate(v):
    ax.arrow(.1,overhang,.6,0, width=0.001, color="k", 
             head_width=0.1, head_length=0.15, overhang=overhang)

ax.set_yticks(v)
ax.set_xticks([])
ax.set_ylabel("overhang")
ax.set_ylim(-0.3,1.1)
plt.tight_layout()
plt.show()

enter image description here

Post a Comment for "How To Get An Open And Scaling Arrow Head In Matplotlib"