This is goes in the same direction as this question.
I want to point an arrow from one scatter point to another, so that the arrow head lies next to edge of the marker. Like in the following example:
import matplotlib.pyplot as plt
import matplotlib as mpl
fig, ax = plt.subplots()
ax.scatter([0,1],[0,1], s=300)
arrow = mpl.patches.FancyArrowPatch(posA=(0,0), posB=(1,1), arrowstyle='-|>', mutation_scale=20, shrinkA=7, shrinkB=7)
plt.show()
Here I chose the values of shrinkA
and shrinkB
manually so that the arrow head is lying very close from the edge of the target scatter point. However, I would have to change those values if I change the size of the markers.
My question is: Knowing the size of the markers (kwarg s
in ax.scatter), how can chose shrinkA
and shrinkB
so that the arrow lies close from the marker's edge?
I know that s
is measured in p^2 where p is a typographic point. So that the radius of the marker is sqrt(s / pi)
. If shrinkA
and shrinkB
are measured in the same typographic points, we could just do shrinkB=radius
where radius
is the radius of the marker.
For s==300 this makes sense as the radius is close to 9.8.