title: ggplot2 adding dynamic arrow annotations pointing at specific data points that remain proportional to the scale of the overall plot
body: <p>I would like to create a template that would allow me to create a line graph of stock prices with the ability to add arrows pointing at specific dates. The annotation function on ggplot2 does not allow for resizing with the scale of the plot. Is there any workaround?</p>
  
  <p>For example, in this plot with only 6 dates the arrows are sized properly with the chart:</p>
  
  <pre><code>prices&lt;-c(3,5,28,17,62,10)
  prices2&lt;-prices-1
  prices3&lt;-prices-11
  dates&lt;-seq.Date(from=as.Date("2018-1-1"),to=as.Date("2018-1-6"),"days")
  
  ggplot()+
  geom_line(aes(dates,prices))+
  annotate(
  "segment",
  x=dates,
  xend=dates,
  y=prices3,
  yend=prices2,
  color="blue",
  arrow=arrow(length=unit(0.5,"cm")
              ))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/WvZQi.png" alt="enter image description here"></p>
  
  <p>However when I increase the period to 15 dates the arrows do not scale proportionally and look like this:</p>
  
  <p><img src="https://i.stack.imgur.com/u52YT.png" alt="enter image description here"></p>