Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ggplot_build

Build ggplot for rendering.


Description

ggplot_build() takes the plot object, and performs all steps necessary to produce an object that can be rendered. This function outputs two pieces: a list of data frames (one for each layer), and a panel object, which contain all information about axis limits, breaks etc.

Usage

ggplot_build(plot)

layer_data(plot, i = 1L)

layer_scales(plot, i = 1L, j = 1L)

layer_grob(plot, i = 1L)

Arguments

plot

ggplot object

i

An integer. In layer_data(), the data to return (in the order added to the plot). In layer_grob(), the grob to return (in the order added to the plot). In layer_scales(), the row of a facet to return scales for.

j

An integer. In layer_scales(), the column of a facet to return scales for.

Details

layer_data(), layer_grob(), and layer_scales() are helper functions that return the data, grob, or scales associated with a given layer. These are useful for tests.

See Also

print.ggplot() and benchplot() for functions that contain the complete set of steps for generating a ggplot2 plot.


ggplot2

Create Elegant Data Visualisations Using the Grammar of Graphics

v3.3.3
MIT + file LICENSE
Authors
Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Winston Chang [aut] (<https://orcid.org/0000-0002-1576-2126>), Lionel Henry [aut], Thomas Lin Pedersen [aut, cre] (<https://orcid.org/0000-0002-5147-4711>), Kohske Takahashi [aut], Claus Wilke [aut] (<https://orcid.org/0000-0002-7470-9261>), Kara Woo [aut] (<https://orcid.org/0000-0002-5125-4188>), Hiroaki Yutani [aut] (<https://orcid.org/0000-0002-3385-7233>), Dewey Dunnington [aut] (<https://orcid.org/0000-0002-9415-4582>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.