ggpage_plot: Creates a visualization from the ggpage_build output

Description Usage Arguments Value Examples

Description

Creates a visualization from the ggpage_build output

Usage

1
2
3
ggpage_plot(data, mapping = ggplot2::aes(), paper.show = FALSE,
  paper.color = "grey90", paper.alpha = 1, paper.limits = 3,
  page.number = character(1), page.number.x = 3, page.number.y = 3)

Arguments

data

data.frame. Expects output from ggpage_build with optional intermediate analysis.

mapping

Default list of aesthetic mappings to use for plot to be handed to internal ggplot call.

paper.show

Shows the paper underneath the text.

paper.color

Color of the pages. Needs to be of length 1 or the same as the number of pages.

paper.alpha

Alpha of the pages. Needs to be of length 1 or the same as the number of pages.

paper.limits

Numerical. Extends the edges of the paper in all directions.

page.number

Position of the page number. Defaults to none.

page.number.x

Distance the page number is pushed away from the text along the x-axis.

page.number.y

Distance the page number is pushed away from the text along the y-axis.

Value

A ggplot object with the given visualization.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(dplyr)
library(stringr)
library(ggplot2)
library(tidytext)
library(ggpage)
# build and plot
## data.frame with full lines
ggpage_build(tinderbox) %>%
  ggpage_plot()
## vector with full lines
ggpage_build(book = tinderbox %>%
  pull(text)) %>%
  ggpage_plot()
## data.frame with single words
ggpage_build(tinderbox) %>%
  unnest_tokens(text, word) %>%
  ggpage_plot()
## vector with single words
ggpage_build(tinderbox %>%
  unnest_tokens(text, text) %>%
  pull(text)) %>%
  ggpage_plot()

# nrow and ncol
ggpage_build(tinderbox, nrow = 2) %>%
  ggpage_plot()
ggpage_build(tinderbox, ncol = 2) %>%
  ggpage_plot()

# Include analysis within
ggpage_build(tinderbox) %>%
  mutate(word_length = str_length(word)) %>%
  ggpage_plot(aes(fill = word_length))

ggpage documentation built on June 14, 2019, 1:02 a.m.