Is there a possibility to add the arrow head at the end of a geom_segment instead of having the arrow head pointing to the end of a geom_segment in ggplot2?
An example:
- The upper arrow is what you get naturally: the arrow head points to the end of the
geom_segment(or: the arrow heads points tox = 1); - The bottom arrow is what I want: the arrow head should start at the end of the
geom_segmentand pointing a bit further (or: the arrow head starts atx = 1).
What I did so far:
The code that produced the plot above is manually tweaked and only works for a given plot size:
ggplot() +
geom_segment(aes(x = 0, y = 1, xend = 1, yend = 1), arrow = arrow()) +
geom_segment(aes(x = 0, y = 0, xend = 1.05, yend = 0), arrow = arrow()) +
ylim(-1, 2)
With another plot size, the code does produce something different that is not what I want:
Therefore I'm on the search for an option inside arrow() (I did not find something useful, as ends = "last" is the default value and produces the same plots as shown above..) or an alternative geom_. Inside arrow().
Any hints?
The comments from @mnm do not do what I am searching for:
ggplot() +
geom_segment(aes(x = 0, y = 1, xend = 1, yend = 1), arrow = arrow(ends = "last")) +
geom_segment(aes(x = 0, y = 0, xend = 1.01, yend = 0), arrow = arrow(ends = "last")) +
ylim(-1, 2)



