Learn R Programming

animint2 (version 2025.9.16)

animint2pages: Publish a list of ggplots as interactive visualizations on a GitHub repository

Description

This function takes a named list of ggplots, generates interactive animations, and pushes the generated files to a specified GitHub repository. You can choose to keep the repository private or public. Before using this function set your appropriate git 'user.username' and 'user.email'

Usage

animint2pages(
  plot.list,
  github_repo,
  owner = NULL,
  commit_message = "Commit from animint2pages",
  private = FALSE,
  required_opts = c("title", "source"),
  chromote_sleep_seconds = NULL,
  chromote_width = 3000,
  chromote_height = 2000,
  ...
)

Value

The function returns the initialized GitHub repository object.

Arguments

plot.list

A named list of ggplots and option lists.

github_repo

The name of the GitHub repository to which the files will be pushed.

owner

The user/org under which the repo will be created, default comes from gh::gh_whoami.

commit_message

A string specifying the commit message for the pushed files.

private

A logical flag indicating whether the GitHub repository should be private or not (default FALSE).

required_opts

Character vector of plot.list element names which are checked (stop with an error if not present). Use required_opts=NULL to skip check.

chromote_sleep_seconds

if numeric, chromote will be used to take a screenshot of the data viz, pausing this number of seconds to wait for rendering (experimental).

chromote_width

width of chromote window in pixels, default 3000 should be sufficient for most data viz, but can be increased if your data viz screenshot appears cropped too small.

chromote_height

height of chromote window in pixels, default 2000 should be sufficient for most data viz, but can be increased if your data viz screenshot appears cropped too small.

...

Additional options passed onto animint2dir.

Examples

Run this code
if (FALSE) {
library(animint2)
mtcars$Cyl <- factor(mtcars$cyl)
viz <- animint(
  ggplot(mtcars, aes(x = mpg, y = disp, color=Cyl)) +
    geom_point(),
  ggplot(mtcars, aes(x = hp, y = wt, color=Cyl)) +
    geom_point(),
  title="Motor Trend Cars data viz",
  source="https://github.com/animint/animint2/blob/master/R/z_pages.R"
)
animint2pages(viz, "animint2pages-example-mtcars")
}

Run the code above in your browser using DataLab