A function to calculate the range of x- and y- axes.
Value
A list object that has two elements, each of which has two vector values. The first element stores the minimum and maximum values of the plot's x-axis range, while the second element stores the minimum and maximum values of the plot's y-axis range.
Examples
library(ggplot2)
ggplot(mtcars) + geom_point(aes(mpg, disp)) -> p1
get_axis_range(p1)
#> $x_range
#> [1] 9.225 35.075
#>
#> $y_range
#> [1] 51.055 492.045
#>