ggprism: A ggplot2 Extension Inspired by GraphPad Prism

repository·master·Indexed 42 days ago

https://github.com/csdaw/ggprism

An R package providing themes, palettes, and functions to customize ggplot2 visualizations to match the aesthetic of GraphPad Prism. Features include theme_prism(), scale_color_prism(), scale_fill_prism(), and tools for statistical annotations like add_pvalue().

Tokens
769
Snippets
3
Records
3
Agent score
3%

What's inside ggprism

  1. Install ggprism

    master

    You can install the stable version of ggprism from CRAN or the development version from GitHub.

    Install from CRAN

    install.packages("ggprism")

    Install development version from GitHub

    remotes::install_github("csdaw/ggprism")
  2. Use ggprism to customize ggplot2 themes and scales

    master

    ggprism provides functions to give ggplot2 objects the 'GraphPad Prism' aesthetic. Key components include:

    • Themes: Use theme_prism() to apply the Prism-style theme.
    • Color/Fill Scales: Use scale_color_prism() and scale_fill_prism() with various palette names (e.g., "floral") to apply Prism-inspired color schemes.
    • Guides: Use guides(y = "prism_offset_minor") to customize axis guides.
    • Statistical Annotations: Use add_pvalue() to add p-value annotations to plots.

    Example Usage

    library(ggplot2)
    library(ggprism)
    
    tg <- ToothGrowth
    tg$dose <- as.factor(tg$dose)
    
    base <- ggplot(tg, aes(x = dose, y = len)) + 
      geom_violin(aes(colour = dose, fill = dose), trim = FALSE) + 
      geom_boxplot(aes(fill = dose), width = 0.2, colour = "black") + 
      scale_y_continuous(limits = c(-5, 40))
    
    p_vals <- tibble::tribble(
      ~group1, ~group2, ~p.adj,   ~y.position,
      "0.5",   "1",     8.80e-14, 35,
      "0.5",   "2",     1.27e-7,  39
    )
    
    base + 
      scale_color_prism("floral") + 
      scale_fill_prism("floral") + 
      guides(y = "prism_offset_minor") + 
      theme_prism(base_size = 16) + 
      theme(legend.position = "none") + 
      add_pvalue(p_vals, label = "p = {p.adj}", tip.length = 0, label.size = 4)
  3. Cite ggprism in your research

    master

    If you use ggprism in your publication, please cite it as follows:

    APA Style: Charlotte Dawson (2025). ggprism: A ‘ggplot2’ Extension Inspired by ‘GraphPad Prism’. R package version 1.0.7. https://cran.r-project.org/package=ggprism doi: 10.5281/zenodo.4556067

    BibTeX:

    @Manual{
        title = {ggprism: A 'ggplot2' Extension Inspired by 'GraphPad Prism'},
        author = {Charlotte Dawson},
        year = {2025},
        note = {R package version 1.0.7},
        url = {https://cran.r-project.org/package=ggprism},
        doi = {10.5281/zenodo.4556067}
    }