问题描述
如下图所示,状态名称有时离该行很远。要考虑的一种选择是不将标签放在线条旁边,而是将它们包括在图的右上角的框中。我该怎么办?
geom_line(aes(x =Year,y = Age.Adjusted.Rate,colour = State),data = d_filtered_top5_fe)+
ggrepel::geom_text_repel(aes(x =Year,colour = State,label = State,fontface = 'bold'),data = d_filtered_top5_fe %>%
filter(Year == max(Year)),segment.color = 'transparent',size = 2.5
) +