Create Tibbles and Lists of 'ggplot' Figures for Reporting

Create tibbles and lists of 'ggplot' figures that can be modified as easily as regular 'ggplot' figures. Typical use cases are for creating reports or web pages where many figures are needed with different data and similar formatting.


ggtibble

R-CMD-check CRAN status Codecov test coverage

The goal of ggtibble is to allow creation of similarly-formatted figures as lists of ggplots (gglist) and tibbles of those lists with captions. These are augmented with knit_print() methods enabling simple inclusion in reports.

Installation

You can install the development version of ggtibble from GitHub with:

# install.packages("devtools")
devtools::install_github("humanpred/ggtibble")

Example

This is a basic example which shows you how to solve a common problem:

library(ggtibble)
d_plot <-
  data.frame(
    A = rep(c("foo", "bar"), each = 4),
    B = 1:8,
    C = 11:18,
    Bunit = "mg",
    Cunit = "km"
  )
all_plots <-
  ggtibble(
    d_plot,
    ggplot2::aes(x = B, y = C),
    outercols = c("A", "Bunit", "Cunit"),
    caption = "All the {A}",
    labs = list(x = "B ({Bunit})", y = "C ({Cunit})")
  ) +
  ggplot2::geom_point() +
  ggplot2::geom_line()
knit_print(all_plots)

In an R Markdown or Quarto report, the ggtibble chunk option is a one-line shorthand for the above: it auto-derives the chunk label, sets fig.cap from the object's caption, and runs knit_print() automatically.

```{r ggtibble="all_plots"}
```

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ggtibble")

1.0.4 by Bill Denney, 4 months ago


https://humanpred.github.io/ggtibble/, https://github.com/humanpred/ggtibble


Report a bug at https://github.com/humanpred/ggtibble/issues


Browse source code at https://github.com/cran/ggtibble


Authors: Bill Denney [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports checkmate, dplyr, ggplot2, glue, knitr, purrr, rlang, tibble, tidyr, vctrs

Suggests ggbreak, ggforce, quarto, rmarkdown, spelling, testthat, withr


Imported by nlmixr2plot.


See at CRAN