MyNixOS website logo
Description

A 'ggplot2' Extension Inspired by 'GraphPad Prism'.

Provides various themes, palettes, and other functions that are used to customise ggplots to look like they were made in 'GraphPad Prism'. The 'Prism'-look is achieved with theme_prism() and scale_fill|colour_prism(), axes can be changed with custom guides like guide_prism_minor(), and significance indicators added with add_pvalue().

ggprism

R-CMD-check Codecov testcoverage CRANversion Websitehttps://csdaw.github.io/ggprism DOI

The ggprism package provides various themes, palettes, and other useful functions to customise ggplots and give them the ‘GraphPad Prism’ look.

Install

Install the latest version from CRAN:

install.packages("ggprism")

Install the development version from GitHub:

remotes::install_github("csdaw/ggprism")

How to Use

See the Getting Started page for a quick overview of ggprism features. Detailed examples and instructions can be found below and on the ggprism website.

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

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)
#> Warning: The S3 guide system was deprecated in ggplot2 3.5.0.
#> ℹ It has been replaced by a ggproto system that can be extended.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

Feedback and Contributions

Any feedback, questions, and suggestions are welcome and should be shared via GitHub discussions.

Bug reports should be submitted via GitHub issues with a minimal reproducible example, e.g. using the reprex package.

Contributions to ggprism are also welcome and pull requires should also be submitted via GitHub issues. Please fork/clone this repository and create a new branch to develop your contribution in. Some ways to contribute might include:

  • Updates and corrections to documentation
  • Examples and vignettes for existing functions
  • Bug fixes
  • New functions with associated documentation, examples, and tests

Cite

I would be very grateful if you could cite this package if you use it in your publication:

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

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

More Examples

Recreates this figure from the GraphPad Prism website. See this vignette for the source code and step-by-step instructions.

Recreates Figure 2B from Matsushita & Nishimura (2020), which was originally created using GraphPad Prism. See this vignette for the source code and step-by-step instructions.

Metadata

Version

1.0.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows