How to draw a line with an arrow in Plot.jl?

Hi @lmiq, I have a problem with arrows, which I know how to deal with in LaTeX but not in Julia.

The problem is this: usually if we want a connection between two points (both of which display a marker), the arrow overlaps a bit with the markers. In LaTeX we can say how much distance we want to be kept between the arrow and the marker by typing, e.g., shorten> = 0.09cm. Do you know how we can do this in Plots.jl? I have looked at the documentation, but there is no information about this issue.

An MWE that shows what I have in mind:

x = [1, 3 , NaN, 0.5, 1.0]
y = [1, 0.4,  NaN, 1.5, 0.8]
GR.setarrowsize(1)
plot(x,y, marker =:circle, arrow=(:closed, 2.0))

The output is

The overlapping between arrows and markers can be easily avoided in LaTeX, like this

In simple cases, the overlapping is not a big deal; but the overlapping is quite annoying in more elaborate plotting.

Thanks a lot.

2 Likes