From 3669a37bcecd7df73a24aa994bf42794f3668651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Guillou?= Date: Sun, 7 Apr 2019 22:55:49 +1000 Subject: [PATCH] correct argument description, typos, formatting... I wanted to correct a few typos and an erroneous argument description (`minSize`) but also took the liberty to fix some formatting and rephrase a few sentences. Hope that's ok! :) --- vignettes/wordcloud.Rmd | 44 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/vignettes/wordcloud.Rmd b/vignettes/wordcloud.Rmd index e0fe919..99ffe87 100644 --- a/vignettes/wordcloud.Rmd +++ b/vignettes/wordcloud.Rmd @@ -14,31 +14,32 @@ vignette: > --- -This is an introduction to `wordcloud2` package. This package provides an HTML5 interface to wordcloud for data visualization. [Timdream's wordcloud2.js](https://github.com/timdream/wordcloud2.js) is used in this package. +This is an introduction to the `wordcloud2` package. This package provides an HTML5 interface to wordcloud for data visualization. [Timdream's wordcloud2.js](https://github.com/timdream/wordcloud2.js) is used in this package. ![png](img/wordcloud2.png) -This document show two main function in `Wordcloud2`: +This document describes two main functions in `wordcloud2`: -1. `wordcloud2`: provide traditional wordcloud with HTML5 -2. `letterCloud`: provide wordcloud with selected word(letters). +1. `wordcloud2`: generate a traditional wordcloud with HTML5 +2. `letterCloud`: generate a wordcloud shaped like one or several characters. -### install wordcloud2 +### Install wordcloud2 + +You may have already installed this package. Well, I still want to leave this code here for installing. -You may have installed this package. Well, I still want to leave these codes here for installing. ```{r eval = F} require(devtools) install_github("lchiffon/wordcloud2") ``` -### `wordlcoud2` function +### `wordcloud2` function -You can use wordcloud directly: +You can use wordcloud2 directly: ```{r} library(wordcloud2) wordcloud2(data = demoFreq) ``` -`demoFreq` is a data.frame including word and freq in each column. +`demoFreq` is an example data.frame that includes `word` and `freq` columns. ```{r} head(demoFreq) @@ -46,17 +47,17 @@ head(demoFreq) ### Parameters - `data` - - A data frame including word and freq in each column + - A data.frame including `word` and `freq` columns - `size` - - Font size, default is 1. The larger size means the bigger word. + - Font size, default is 1. The larger the size, the bigger the words. - `fontFamily` - Font to use. - `fontWeight` - Font weight to use, e.g. normal, bold or 600 - `color` - - color of the text, keyword 'random-dark' and 'random-light' can be used. color vector is also supported in this param + - Color of the text, keyword 'random-dark' and 'random-light' can be used. color vector is also supported in this param - `minSize` - - A character string of the subtitle + - Minimum font size to draw on the canvas - `backgroundColor` - Color of the background. - `gridSize` @@ -64,15 +65,15 @@ head(demoFreq) - `minRotation` - If the word should rotate, the minimum rotation (in rad) the text should rotate. - `maxRotation` - - If the word should rotate, the maximum rotation (in rad) the text should rotate. Set the two value equal to keep all text in one angle. + - If the word should rotate, the maximum rotation (in rad) the text should rotate. Set the two values equal to keep all text in one angle. - `rotateRatio` - Probability for the word to rotate. Set the number to 1 to always rotate. - `shape` - - The shape of the "cloud" to draw. Can be a keyword present. Available presents are 'circle' (default), 'cardioid' (apple or heart shape curve, the most known polar equation), 'diamond' (alias of square), 'triangle-forward', 'triangle', 'pentagon', and 'star'. + - The shape of the "cloud" to draw. Can be a keyword present. Available keywords are 'circle' (default), 'cardioid' (apple or heart shape curve, the most known polar equation), 'diamond' (alias of square), 'triangle-forward', 'triangle', 'pentagon', and 'star'. - `ellipticity` - degree of "flatness" of the shape wordcloud2.js should draw. - `figPath` - - A fig used for the wordcloud. + - A file to be used as a mask for the wordcloud (jpeg, jpg, png, bmp or gif) - `widgetsize` - size of the widgets @@ -95,14 +96,14 @@ For example, `t.png` is A BIRD with black and white: ![png](img/t.png) ```{r eval = F} -figPath = system.file("examples/t.png",package = "wordcloud2") -wordcloud2(demoFreq, figPath = figPath, size = 1.5,color = "skyblue") +figPath = system.file("examples/t.png", package = "wordcloud2") +wordcloud2(demoFreq, figPath = figPath, size = 1.5, color = "skyblue") ``` ![png](img/tcloud.png) ### `letterCloud` function -`letterCloud` provide the function to create a wordcloud with a word, like this: +`letterCloud` provides the function to create a wordcloud shapes like a word or a single character, like this: ```{r} letterCloud(demoFreq, word = "R", size = 2) ``` @@ -113,12 +114,12 @@ Or: letterCloud(demoFreq, word = "WORDCLOUD2", wordSize = 1) ``` ![png](img/wordcloud2.png) -**wordcloud with fig and letterCloud may disappeared in Rstudio Viewer, open into brower when you meet this bug** +**Wordclouds generated with `figPath` or `letterCloud()` may disappear in the RStudio viewer. Use "show in new window" if you encounter this bug.** #### Parameters - `data` - - A data frame including word and freq in each column + - A data.frame including `word` and `freq` columns - `word` - A word to create shape for wordcloud. - `wordSize` @@ -127,6 +128,7 @@ letterCloud(demoFreq, word = "WORDCLOUD2", wordSize = 1) - Letter font - `...` - Other parameters for wordcloud2 + Go to [wordcloud2](http://github.com/lchiffon/wordcloud2) in the github to leave a comment or give this package a star. ### shiny