{"id":15628961,"url":"https://github.com/pwwang/gglogger","last_synced_at":"2025-07-20T00:32:59.396Z","repository":{"id":253871964,"uuid":"844773064","full_name":"pwwang/gglogger","owner":"pwwang","description":"gglogger is an R package that logs the calls used to create ggplot2 objects.","archived":false,"fork":false,"pushed_at":"2025-06-19T23:16:59.000Z","size":4015,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T23:46:18.871Z","etag":null,"topics":["ggplot","ggplot2","ggplot2-enhancements"],"latest_commit_sha":null,"homepage":"https://pwwang.github.io/gglogger/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pwwang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-20T00:06:09.000Z","updated_at":"2025-06-19T23:14:08.000Z","dependencies_parsed_at":"2024-12-20T03:47:11.447Z","dependency_job_id":"10f0cdaa-d918-45e2-8b3f-cc82eb496920","html_url":"https://github.com/pwwang/gglogger","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"9f38930d34d79763f0e328b38755436e04b13f8d"},"previous_names":["pwwang/gglogger"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/pwwang/gglogger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fgglogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fgglogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fgglogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fgglogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwwang","download_url":"https://codeload.github.com/pwwang/gglogger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwwang%2Fgglogger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266048622,"owners_count":23868743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ggplot","ggplot2","ggplot2-enhancements"],"created_at":"2024-10-03T10:25:01.516Z","updated_at":"2025-07-20T00:32:59.336Z","avatar_url":"https://github.com/pwwang.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gglogger \u003ca href=\"https://pwwang.github.io/gglogger/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"134\" alt=\"gglogger website\" /\u003e\u003c/a\u003e\n\n`gglogger` is an R package that logs the calls used to create `ggplot2` objects.\n\nThis can be useful for debugging, reproducibility, and understanding the sequence of operations used to build a plot.\n\n\u003e Have you ever created a plot in `ggplot2` and then forgotten how you made it? Or wanted to reproduce a plot but couldn't remember the exact sequence of operations you used? `gglogger` can help!\n\n## Installation\n\nYou can install the `gglogger` package from source using `devtools`:\n\n```r\ndevtools::install_github(\"pwwang/gglogger\")\n\n# or\nremotes::install_github(\"pwwang/gglogger\")\n```\n\n## Usage\n\nTo use the `gglogger` package, simply load it along with `ggplot2` and create your plots as usual. The package will automatically log the calls used to create the plots.\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003ePrevious\u003c/th\u003e\n        \u003cth\u003eNow\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\n\n\n```r\nlibrary(ggplot2)\n\np \u003c- ggplot(mpg, aes(x = displ, y = hwy)) +\n    geom_point()\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n\n```r\nlibrary(ggplot2)\n# Just add gglogger after ggplot2\nlibrary(gglogger)\n\np \u003c- ggplot(mpg, aes(x = displ, y = hwy)) +\n    geom_point()\n\n# Print the logs\nprint(p$logs)\n## ggplot2::ggplot(mpg, aes(x = displ, y = hwy)) +\n##   geom_point()\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nEvaluate the code in logs to reproduce the plot:\n\n```r\np$logs$evaluate()\n```\n\nYou can also attach the variables in an environment for evaluation:\n\n```r\nenv \u003c- new.env()\nenv$mpg \u003c- mpg\nenv$mpg$hwy \u003c- mpg$hwy / 2\np$logs$evaluate(env)\n```\n\n## Registering a function from a ggplot2 extension\n\n```r\nlibrary(dplyr)\nlibrary(gglogger)\n\nmtcars_radar \u003c- mtcars %\u003e%\n  as_tibble(rownames = \"group\") %\u003e%\n  mutate_at(vars(-group), scales::rescale) %\u003e%\n  tail(4) %\u003e%\n  select(1:10)\n\nggradar \u003c- register(ggradar::ggradar)\n\np \u003c- ggradar(mtcars_radar, legend.position = \"right\")\nprint(p$logs)\n\n# ggradar::ggradar(mtcars_radar, legend.position = \"right\")\n```\n\n## Generating code to reproduce a plot\n\n```r\n# p is a ggradar plot created in the previous example\n\ncode \u003c- p$logs$gen_code(setup = '\nlibrary(dplyr)\nlibrary(ggradar)\n\nmtcars_radar \u003c- mtcars %\u003e%\n  as_tibble(rownames = \"group\") %\u003e%\n  mutate_at(vars(-group), scales::rescale) %\u003e%\n  tail(4) %\u003e%\n  select(1:10)\n')\n\ncat(code)\n## library(dplyr)\n## library(ggradar)\n##\n## mtcars_radar \u003c- mtcars %\u003e%\n##   as_tibble(rownames = \"group\") %\u003e%\n##   mutate_at(vars(-group), scales::rescale) %\u003e%\n##   tail(4) %\u003e%\n##   select(1:10)\n##\n##\n## ggradar::ggradar(mtcars_radar, legend.position = \"right\")\n\n# eval(parse(text = code)) # to reproduce the plot\n```\n\n## Limitations\n\n`gglogger` cannot log the global settings used to create a plot, such as `theme_set()`. It can only log the calls used directly to create the plot itself. You may need to manually set these global settings when reproducing a plot, or prepare them using the `setup` argument in `gen_code()`.\n\nIf your data is piped to `ggplot` function, you need to use `|\u003e` instead of `%\u003e%`, otherwise the data will be logged as `.`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwwang%2Fgglogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwwang%2Fgglogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwwang%2Fgglogger/lists"}