gginnards-package {gginnards} | R Documentation |
gginnards: Explore the Innards of 'ggplot2' Objects
Description
Extensions to 'ggplot2' providing low-level debug tools: statistics and geometries echoing their data argument. Layer manipulation: deletion, insertion, extraction and reordering of layers. Deletion of unused variables from the data object embedded in "ggplot" objects.
Details
The new facilities for cleanly defining new stats and geoms added to package 'ggplot2' in version 2.0.0 gave origin to this package. I needed tools to help me learn how layers work and to debug the extensions to 'ggplot2' that I was developing. I share them through this package in the hope that they will help other users of 'ggplot2' understand how this this very popular graphics package works internally. The vignettes provide examples of how to use these tools both for debugging and learning how ggplots are stored.
Extensions provided:
"Debug" stats and a "debug" geom that print to the console a summary of their
data
input.Functions for inspecting and manipulating the list of layers of a ggplot object.
Functions for exploring and manipulating the data embedded in ggplot objects, including dropping unused variables.
Author(s)
Maintainer: Pedro J. Aphalo pedro.aphalo@helsinki.fi (ORCID)
References
Package 'tidyverse' web site at https://www.tidyverse.org/
Package 'ggplot2' documentation at https://ggplot2.tidyverse.org/
Package 'ggplot2' source code at https://github.com/tidyverse/ggplot2
See Also
Useful links:
Report bugs at https://github.com/aphalo/gginnards/issues
Examples
# echo the 'data' and 'params' as received by 'draw_panel()'
ggplot(mtcars, aes(cyl, mpg, color = factor(cyl))) +
geom_point() +
geom_debug_panel()
# echo the 'data' and 'params' as received by 'draw_group()'
ggplot(mtcars, aes(cyl, mpg, color = factor(cyl))) +
geom_point() +
geom_debug_group()
# echo the 'data' and 'params' as received by 'draw_panel()'
ggplot(mtcars, aes(cyl, mpg, colour = factor(cyl))) +
stat_summary(fun.data = "mean_se") +
stat_summary(fun.data = "mean_se", geom = "debug_panel")
# echo the 'data' received by 'compute_panel()'
ggplot(mtcars, aes(cyl, mpg, color = factor(cyl))) +
geom_point() +
stat_debug_panel()
# echo the 'data' received by 'compute_group()'
ggplot(mtcars, aes(cyl, mpg, color = factor(cyl))) +
geom_point() +
stat_debug_group()