How to change the head size of the double head annotate in matplotlib?

Viewed 7240

Below figure shows the plot of which arrow head is very small... enter image description here

I tried below code, but it didnot work... it said " raise AttributeError('Unknown property %s' % k) AttributeError: Unknown property headwidth"...

xyfrom=[10,620]
xyto=[130,620]
ax.annotate("",xyfrom,xyto,arrowprops=dict(arrowstyle='<->',linewidth = 2,     headwidth=10,color = 'k'
))
ax.text((xyto[0]+xyfrom[0])/2-15,(xyto[1]+xyfrom[1])/2+10,"headwidth is too    small",fontsize=24)
2 Answers

... since none of the above answers worked for me... here's my solution:

Use the "mutation_scale" argument! (see doc of FancyArrowPatch )

import matplotlib.pyplot as plt
f, ax = plt.subplots()

ax.scatter([1,2,3,4,5],[1,2,3,4,5])

ann = ax.annotate(rf'small head annotation',
                  xy=(2,2),  xycoords='data',
                  xytext=(.28, .5), textcoords='figure fraction',
                  size=10, va="center", ha="center",
                  bbox=dict(boxstyle="round4", fc="w"),
                  arrowprops=dict(arrowstyle="-|>",mutation_scale=25,
                                  connectionstyle="arc3,rad=-0.2", fc="w"))

ann2 = ax.annotate(rf'BIG head annotation',
                  xy=(2,2),  xycoords='data',
                  xytext=(.75, .15), textcoords='figure fraction',
                  size=10, va="center", ha="center",
                  bbox=dict(boxstyle="round4", fc="w"),
                  arrowprops=dict(arrowstyle="-|>",mutation_scale=50,
                                  connectionstyle="arc3,rad=-0.2", fc="w"))

 [

Related