ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Consider handling/setting `margin()`'s default values based on the theme being used

Open arnaudgallou opened this issue 1 year ago • 0 comments

Currently, the default margin values of margin() are set to 0. This is not ideal because if a user wants to change the margin only on one side of a plot, it forces the user to 1) find out what the default margins of the theme being used are and 2) redefine the default margin values on each other side of a plot.

It would be more convenient if margin() could handle the default values internally (or via a function passed as the default arguments) based on the theme being used so that e.g. one could write:

# ... +
  theme_classic() +
  theme(plot.margin = margin(r = 9.5))

Instead of:

# ... +
  theme_classic() +
  theme(plot.margin = margin(5.5, 9.5, 5.5, 5.5))

arnaudgallou avatar Sep 18 '24 17:09 arnaudgallou