The ggpage
package allows for variable length of paragraphs if the text doesn’t hold information regarding paragraphs. This is done by supplying the variable.paragraph.length
argument in ggpage_build
with a function that generate random natural numbers. Such as the rpois
function.
With the newest update ggpage
allows you to draw a rectangle around each “page”.
It allows you use specify a color both as a constant,
or by a string of colors. In this case a faded rainbow.
It can be hard to see the order of the pages in the standard vizualization. However it is possible to add a page number in the sides or corners of each page.
The package also support a variable page length. This can be helpful when a collection of smaller texts are considered in the same vizualisation such as tweets.
ggpage
now supports left, right and both-sided alignments.
Lastly for convience does ggpage
include a way to transform a data.frame with paragraph tokens to a data.frame with line tokens.
nest_paragraphs(data = tinderbox_paragraph, input = text) %>%
head()
#> text
#> 1 A soldier came marching along the high road: "Left, right - left, right." He
#> 2 had his knapsack on his back, and a sword at his side; he had been to the wars,
#> 3 and was now returning home. As he walked on, he met a very frightful-looking old
#> 4 witch in the road. Her under-lip hung quite down on her breast, and she stopped
#> 5 and said, "Good evening, soldier; you have a very fine sword, and a large
#> 6 knapsack, and you are a real soldier; so you shall have as much money as ever
nest_paragraphs(tinderbox_paragraph, text, width = 40) %>%
head()
#> text
#> 1 A soldier came marching along the high
#> 2 road: "Left, right - left, right." He
#> 3 had his knapsack on his back, and a
#> 4 sword at his side; he had been to the
#> 5 wars, and was now returning home. As
#> 6 he walked on, he met a very frightful-