R interface to wordcloud for data visualization. Timdream's wordcloud2.js is used in this package.
Bugs below are fixed:
-
if you install
wordcloud2
byinstall.packages("wordcloud2")
(version 0.2.1), you will get the background image for either letterCloud() or the figPath option of wordcloud2. -
if you install
wordcloud2
bydevtools::install_github("lchiffon/wordcloud2")
(version 0.2.0), your plot on R-shiny will be unclickable.
devtools::install_github("JacobXPX/wordcloud2")
library(shiny)
library(wordcloud2)
library(tm)
shinyApp(
ui = shinyUI(fluidPage(
mainPanel(
wordcloud2Output("wordcloud", clickedWordInputId = "selected_word")
),
sidebarPanel(
textOutput("selected_var")
)
)),
server = shinyServer(function(input, output) {
figPath = system.file("examples/t.png",package = "wordcloud2")
wordcloud_plot <- wordcloud2(data = demoFreq, figPath = figPath, size = 0.6,color = "blue")
output$wordcloud <- renderWordcloud2(wordcloud_plot)
output$selected_var <- renderText({
paste("You have selected", input$selected_word)
})
})
)
run the above code and click refresh, it will work.
devtools::install_github("lchiffon/wordcloud2")
knitr and shiny is support in wordcloud2 package.
library(wordcloud2)
wordcloud2(demoFreq, size = 1,shape = 'star')
wordcloud2(demoFreq, size = 2, minRotation = -pi/2, maxRotation = -pi/2)
wordcloud2(demoFreq, size = 2, minRotation = -pi/6, maxRotation = -pi/6,
rotateRatio = 1)
## Sys.setlocale("LC_CTYPE","eng")
wordcloud2(demoFreqC, size = 2, fontFamily = "微软雅黑",
color = "random-light", backgroundColor = "grey")