| Type: | Package | 
| Title: | Track 'ggplot2' Calls | 
| Version: | 0.1.7 | 
| 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. | 
| License: | MIT + file LICENSE | 
| Imports: | ggplot2, cli, methods | 
| Suggests: | rlang, testthat, S7 | 
| RoxygenNote: | 7.3.3 | 
| Encoding: | UTF-8 | 
| URL: | https://github.com/pwwang/gglogger/ | 
| NeedsCompilation: | no | 
| Packaged: | 2025-10-08 06:53:58 UTC; pwwang | 
| Author: | Panwen Wang | 
| Maintainer: | Panwen Wang <pwwang@pwwang.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-10-08 07:10:02 UTC | 
Override + operator for ggplot objects to log calls
Description
Override + operator for ggplot objects to log calls
Usage
## S3 method for class 'gg'
e1 + e2
Arguments
| e1 | A ggplot object. | 
| e2 | A layer to add to the ggplot object. | 
Value
A ggplot object with logged calls.
Override + operator for ggplot objects to log calls
Description
Override + operator for ggplot objects to log calls
Usage
.add_gg(e1, e2)
Arguments
| e1 | A ggplot object. | 
| e2 | A layer to add to the ggplot object. | 
Value
A ggplot object with logged calls.
GGLog class
Description
The 'GGLog' class is used to store a single ggplot call.
Fields
- code
- A string to store the code of the ggplot call. 
Methods
- evaluate(envir = parent.frame())
- Evaluate the log. - @param envir The environment to evaluate the log in. 
- stringify()
- Stringify the log. - @return A string. 
GGLogs class
Description
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.
Fields
- logs
- A list to store the logs. 
Methods
- 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
Description
Override ggplot function to log calls
Usage
ggplot(...)
Arguments
| ... | Arguments passed to ggplot2::ggplot. | 
Value
A ggplot object with logged calls.
Print a GGLog object
Description
Print a GGLog object
Usage
## S3 method for class 'GGLog'
print(x, ...)
Arguments
| x | A GGLog object. | 
| ... | Additional arguments. | 
Value
Display the logs and invisibly return the logs.
Print a GGLogs object
Description
Print a GGLogs object
Usage
## S3 method for class 'GGLogs'
print(x, ...)
Arguments
| x | A GGLogs object. | 
| ... | Additional arguments. | 
Value
Display the logs and invisibly return the logs.
Register a function that returns a ggplot object This is usually implemented by ggplot extensions.
Description
Register a function that returns a ggplot object This is usually implemented by ggplot extensions.
Usage
register(f, name = NULL)
Arguments
| f | A function that returns a ggplot object. | 
| name | A string to represent the name of the function. | 
Value
A function that returns a ggplot object with logged calls.