Can someone school me on the best way to add arrows to ggplot? I have a little reprex below in which I draw an arrow. The first method is copied from Statology. The second method is from the R Graphics Cookbook. The former seems a little easier. The latter, well, the R Graphics Cookbook is the bible as far as I'm concerned.
Can anyone tell me the difference in the two approaches? Any pros and cons?
I would say a fundamental difference is that geom_segment() is a mapping between data and a geom, here we're "cheating" by using fixed data in aes(x=1) instead of of a column name aes(x= x). Whereas annotate() is explicit about the fact that we're not drawing data, we're annotating on top of it with fixed values.
I don't think there is an explicit pro or con to these approaches, but the annotate() feels more natural to add an arrow at a fixed point, whereas I would keep the geom_segment() for cases where x and y are given by the data.