Here is a MWE:
library(ggplot2)
p<- ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point() +
geom_smooth(method = "lm", formula = y~x)
Can someone please show me how to compute the dimensions of the plotted area ( that is the area which has the grey background NOT including the legend) ?