假設我在下面ggplot
set.seed(1)
x<-rnorm(20)
y<-rnorm(20)
df<-data.frame(x,y)
df
library(ggplot2)
ggplot(df,aes(x,y)) geom_point() ggtitle("Scatterplot") theme(plot.title=element_text(margin=margin(t=10,b=-20)))
有了這個,我在下面ggplot

雖然這很好,但我想居中對齊標題而不改變它的垂直位置。
有什么辦法可以做到這一點?
uj5u.com熱心網友回復:
theme(plot.title = element_text(hjust = 0.5, margin = margin(t=10,b=-20)))
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/462736.html
