如果我有一个标题是这样的
... +
ggtitle('Something\nSomething Else\nSomething Else')
有没有办法让每一行都居中对齐,而不是左对齐居中?
...+
theme(plot.title=element_text(hjust=0.5))
使文本居中,但左对齐。
发布于 2013-04-18 12:41:29
这对你有用吗,
# install.packages("ggplot2", dependencies = TRUE)
require(ggplot2)
DF <- data.frame(x = rnorm(400))
m <- ggplot(DF, aes(x = x)) + geom_histogram()
m + labs(title = "Vehicle \n Weight-Gas \n Mileage Relationship \n
and some really long so that you can seee it's centered") +
theme(plot.title = element_text(hjust = 0.5))
很抱歉plot title…中的拼写错误
https://stackoverflow.com/questions/16074440
复制相似问题