CCurtis
CCurtis

Reputation: 1932

What are the default ggplot2 plot margins?

I cannot find information on this anywhere. I know how to set them but want to know the defaults (top, right, bottom, and left) so its less of a guessing game when setting margins for a plot.

Upvotes: 36

Views: 15842

Answers (1)

scoa
scoa

Reputation: 19857

For plot margins as well as other parameters, the default values are that of theme_grey:

theme_grey()$plot.margin
[1] 5.5pt 5.5pt 5.5pt 5.5pt

However, the default theme might change in the future, and you can set a different one (with theme_set()) so a more robust way would be to use theme_get() which returns the current theme (@r2evans comment)

theme_get()$plot.margin 

Upvotes: 57

Related Questions