Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for Implementing ggcall into GGally for Enhanced Plot Reproducibility #498

Open
Polkas opened this issue Apr 23, 2024 · 0 comments

Comments

@Polkas
Copy link

Polkas commented Apr 23, 2024

Hello GGally Team,

I hope this message finds you well. I am a developer working on an enhancement tool called ggcall, designed to improve the transparency and reproducibility of ggplot2 visualizations by overwriting the ggplot and + operator functions. This tool enables full visibility of the plotting code even when ggplot2 is used within other functions, leveraging metaprogramming to ensure precise replication.

I have developed a fork of GGally where ggcall has been integrated successfully, and I would like to propose this addition to the main GGally repository. The integration has significantly enhanced the functionality of GGally by making the plot creation process fully transparent and reproducible.
Integrating ggcall requires adding a new R script (small one file) to the GGally package and modifying the already overridden + operator from ggplot2 within GGally. Please check out the fork and https://github.com/Polkas/ggcall/blob/main/inst/ggally.R.

Benefits of Integrating ggcall into GGally:

  • Enhanced Transparency and Reproducibility: Users can see and replicate the exact code used in plot creations, which is crucial for academic and research purposes where verification of visual data representation is needed.
  • Increased Usability: Makes GGally more user-friendly for new R users who are learning plot construction by providing them with clear coding paths used in plot generation.
  • Community Growth: Attracts a broader user base who value open science and transparency in coding.

Example Usage:

Here's how ggcall can be used with GGally:

remotes::install_github("https://github.com/Polkas/ggally")
library(GGally)
data(mtcars)
gg <- ggcorr(mtcars, method = "everything", label = TRUE)
gg_call <- ggcall(gg)
gg_call
# Optionally: Style the code with styler
# styler::style_text(deparse1(gg_call))
# Optional
# Access call environment and/or use it to evaluate the call
# as.list(ggcall_env(gg_call))
eval_ggcall(gg_call)
#'
data(iris)
gg <- ggscatmat(iris, color = "Species")
gg_call<- ggcall(gg)
gg_call
# Optionally: Style the code with styler
# styler::style_text(deparse1(gg_call))
# Optional
# Access call environment and/or use it to evaluate the call
# as.list(ggcall_env(gg_call))
eval_ggcall(gg_call)
#'
data(tips, package = "reshape")
# Not supported for ggmatrix like plots
gg <- ggduo(tips, mapping = ggplot2::aes(colour = sex), columnsX = 3:4, columnsY = 1:2)
# Will fail
# gg_call<- ggcall(gg)

Fork Repository:
You can find the working implementation in my forked repository here: ggcall-GGally fork

I believe this enhancement will be a valuable addition to GGally. I am eager to hear your thoughts on this proposal and discuss any potential concerns you might have. Thank you for considering this integration. I look forward to your feedback.

Best regards,
Maciej Nasinski

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant