1.先使用dplyr选取每类汽车中效率最高的型号,然后在图形中标记出来

2.可以使用nudge_y参数让标签位于相应数据点正上方

3.使用ggrepel包,自动调整标签的位置,使它们避免于重叠

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = class)) +
  geom_point(size = 3, shape = 1, data = best_in_class) +
  ggrepel::geom_label_repel(aes(label = model), data = best_in_class)