| Title: | Track 'ggplot2' Calls |
|---|---|
| Description: | Provides a way to log 'ggplot' component calls, which can be useful for debugging and understanding how 'ggplot' objects are created. The logged calls can be printed, saved, and re-executed to reproduce the original 'ggplot' object. |
| Authors: | Panwen Wang [aut, cre] (ORCID: <https://orcid.org/0000-0002-4614-8970>) |
| Maintainer: | Panwen Wang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.8 |
| Built: | 2026-05-14 08:54:07 UTC |
| Source: | https://github.com/pwwang/gglogger |
The 'GGLog' class is used to store a single ggplot call.
codeA string to store the code of the ggplot call.
evaluate(envir = parent.frame())Evaluate the log.
@param envir The environment to evaluate the log in.
stringify()Stringify the log.
@return A string.
The 'GGLogs' class is used to store logs of ggplot calls. Each log is stored as a 'GGLog' object. The object can be accessed using the '$logs' field from a ggplot object.
logsA list to store the logs.
add(log)Add a log to the list.
@param log A GGLog object.
evaluate(envir = parent.frame())Evaluate all logs in the list.
@param envir The environment to evaluate the logs in.
gen_code(setup = "library(ggplot2)")Generate code for all logs in the list.
@param setup A string to setup the environment.
@return A string of code.
stringify()Stringify all logs in the list.
@return A string.
Override ggplot function to log calls
ggplot(...)ggplot(...)
... |
Arguments passed to ggplot2::ggplot. |
A ggplot object with logged calls.
Print a GGLog object
## S3 method for class 'GGLog' print(x, ...)## S3 method for class 'GGLog' print(x, ...)
x |
A GGLog object. |
... |
Additional arguments. |
Display the logs and invisibly return the logs.
Print a GGLogs object
## S3 method for class 'GGLogs' print(x, ...)## S3 method for class 'GGLogs' print(x, ...)
x |
A GGLogs object. |
... |
Additional arguments. |
Display the logs and invisibly return the logs.
Register a function that returns a ggplot object This is usually implemented by ggplot extensions.
register(f, name = NULL)register(f, name = NULL)
f |
A function that returns a ggplot object. |
name |
A string to represent the name of the function. |
A function that returns a ggplot object with logged calls.