R语言 ggplot函数中 annotate选项增加注释

 

001、基础绘图

ggplot(data=mtcars, aes(x=mpg, y=disp, 
  color=factor(cyl))) + geom_point()            ## 基础绘图

 

002、annotete在任意位置增加注释

ggplot(data=mtcars, aes(x=mpg, y=disp,      ## 在坐标, 25, 300处增加QQ
  color=factor(cyl))) + geom_point() +
annotate("text", label = "QQQ", x = 25, y = 300, size=6, col = "red") 

 

 

posted @ 2023-07-09 18:04  小鲨鱼2018  阅读(84)  评论(0编辑  收藏  举报