facet_wrap(~ merge_data$V1) +
theme(
panel.grid = element_blank(),
panel.background = element_blank(),
axis.line = element_line(size = 0.5, color = "black"),
axis.text.x = element_text(size = "20px"),
axis.text.y = element_text(size = "10px"),
axis.title.y = element_text(size = "15px"),
legend.title = element_blank(),
legend.text = element_text(size = "15px"),
strip.text = element_text(size = "15px",
face = "bold"), #设置分面标题
strip.background = element_rect(fill = "#d2dae2") #设置分面背景
)
facet_wrap(~V3,nrow = 3,ncol = 1)
df1<-data.frame(V1=c('A2','At','D5','Dt'),
label=c('a','b','c','d'),
x=c(5,5,5,5),
y=c(35,35,35,35)
)
##分面注释
facet_wrap(~V1,nrow=2)+
geom_text(data=df1,
aes(x,y,label),
size = 12)+
expression()
中的下标为[]
,上标为^
,空格为~
,连接符为*
。示例代码如下:
geom_text(data=df1,
aes(x,y,),
label=c(expression(paste('a\n',r^2,'=',sep="\n")),
expression(paste('b\n',r^2,'=',sep="\n")),
expression(paste('c\n',r^2,'=',sep="\n")),
expression(paste('d\n',r^2,'=',sep="\n"))),
size = 5)