I am trying to reproduce the solution here, but alter the arrows to be thicker. I am a bit stumped on how to accomplish this.
I have looked into using the arrows function since it has the ability to implement lwd but do not know how to get the mapping to x0, x1, y0, y1. Is there additional arguments that can be passed on to layer that can change the linewidth of the arrows?
I first answer assuming that the question is about
stat_valleys()andstat_peaks()from package 'ggpmisc' and that the geom in use isgeom_segment()from 'ggplot2', rather thangeom_text_s()orgeom_label_s()from package 'ggpp' orgeom_label_repel()orgeom_text_repel()from pacakge 'ggrepel'. I will usestat_peaks()for the answer asstat_valleys()works similarly.I have used a constant value for the
linewidthaesthetic, but it is possible to map a variable instead. Arrow tips can be added to segments, segments are most frequently used without arrow tips.Created on 2024-03-01 with reprex v2.1.0
It is also possible to use
geom_text_s(). In the documentation ofstat_peaks()andstat_valleys()there are examples usinggeom_text_s(). In these examples the displacement that creates the arrow is obtained by nudging. These examples can be easily modified by making the label text transparent, which is a kludge, but also works in most cases.Created on 2024-03-01 with reprex v2.1.0