001、基础绘图
library(ggplot2)#导入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() ## 基础绘图
002、设置y轴刻度标签到y轴的距离
a、设置为1
library(ggplot2)#导入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.text.y=element_text(margin = margin(r = 1))) ## 设置为1
b、设置为10
library(ggplot2)#导入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() + theme(axis.text.y=element_text(margin = margin(r = 10))) ## 设置为10
。
标签:point,text,ggplot,theme,绘图,刻度,标签,margin From: https://www.cnblogs.com/liujiaxin2018/p/18061682