Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
240 views
in Technique[技术] by (71.8m points)

r - Increasing area around plot area in ggplot2


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Margins around plot can be modified with theme() and plot.margin= where you provide size of margins starting with top, then right, bottom and left. Library grid is attached to use function unit().

library(grid)
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + 
  theme(axis.title.x = element_text(family="Times",size=20,
                face="bold",colour = "Black",vjust=-1,hjust=0.5))+
  theme(plot.margin=unit(c(1,1,1.5,1.2),"cm"))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...