Save Incremental Builds of Plots

Saves a 'ggplot' object into multiple files, each with a layer added incrementally. Generally to be used in presentation slides. Flexible enough to allow different file types for the final complete plot, and intermediate builds.


Build Status Code Coverage CRAN_Status_Badge

ggbuildr is a simple tool for saving incremental "builds" of a ggplot object. Intended use-case is to save plots for presentation slides.

Installation

To install from GitHub:

# install.packages("devtools")
devtools::install_github("jongbinjung/ggbuildr")

Usage

library(ggplot2)
library(ggbuildr)
 
set.seed(1)
X <- rnorm(20)
Y <- X + rnorm(20)
 
pd <- data.frame(X, Y)
p <- ggplot(pd, aes(X, Y)) +
  geom_smooth() +
  geom_point(shape = 21, size = 2,
             fill = "white", color = "black") +
  # Fixing the limits ensure plot ranges are constant
  coord_cartesian(xlim = c(-2.5, 2), ylim = c(-4, 4))
 
# Plot smooth, and then point
build_plot(p, build_order = list(1, 2))

 
# Plot point, and then smooth, but preserve order (i.e, keep points on top)
build_plot(p, build_order = list(2, 1))

 
# Plot point, and then smooth, and draw smooth layer on top of point
build_plot(p, build_order = list(2, 1), preserve_order = FALSE)

News

ggbuildr 0.1.0

  • Initial release

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("ggbuildr")

0.1.0 by Jongbin Jung, a year ago


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


Authors: Jongbin Jung


Documentation:   PDF Manual  


GPL-3 | file LICENSE license


Imports purrr, readr, tools

Depends on ggplot2

Suggests testthat


See at CRAN