This function retrieves the minimum and maximum x and y dimensions of a ggplot object. Note that it is the dimension of the plot within the x and y axis and not the dimensions of the actual output image itself. This may be useful for numerical computations when modifying plots, but can be slow since it builds the actual plot first.
Examples
library(ggplot2)
getPlotDims(ggplot(mtcars) + geom_point(aes(mpg, cyl)))
#> $xr
#> [1] 10.4 33.9
#>
#> $yr
#> [1] 4 8
#>