标题居中
以r语言自带的数据cars为例
library(tidyverse)
cars
m <-"abcacamxlasnxsasajsaojs oajsiahsaijsajosajoasj"
ggplot(cars,aes(speed,dist))+geom_point()+
labs(title = m)
标题居中:
只需要加入下面这行命令就可以了
theme(plot.title = element_text(size=12,hjust=0.5))
library(tidyverse)
cars
m <-"abcacamxlasnxsasajsaojs oajsiahsaijsajosajoasj"
ggplot(cars,aes(speed,dist))+geom_point()+
labs(title = m)+
theme(plot.title = element_text(size=12,hjust=0.5))
标题换行
把要换行的部分用\n
隔起来就行了
m <-"abcacamxlasnxsasajsaojs \n oajsiahsaijsajosajoasj"
ggplot(cars,aes(speed,dist))+geom_point()+
labs(title = m)+
theme(plot.title = element_text(size=12,hjust=0.5))
其他