Learn R Programming

ggsem (version 0.9.9)

get_axis_range: Get axis range of a ggplot object

Description

A function to calculate the range of x- and y- axes.

Usage

get_axis_range(plot)

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.

Arguments

plot

ggplot output from csv_to_ggplot()

Examples

Run this code
library(ggplot2)
ggplot(mtcars) + geom_point(aes(mpg, disp)) -> p1
get_axis_range(p1)

Run the code above in your browser using DataLab