Description Usage Arguments Value Examples
Creates a visualization from the ggpage_build output
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)
|
data |
data.frame. Expects output from |
mapping |
Default list of aesthetic mappings to use for plot to be
handed to internal |
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. |
A ggplot object with the given visualization.
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.