wordcloud2函数

Usage:

wordcloud2(data, size = 1, minSize = 0, gridSize =  0,
    fontFamily = 'Segoe UI', fontWeight = 'bold',
    color = 'random-dark', backgroundColor = "white",
    minRotation = -pi/4, maxRotation = pi/4, shuffle = TRUE,
    rotateRatio = 0.4, shape = 'circle', ellipticity = 0.65,
    widgetsize = NULL, figPath = NULL, hoverFunction = NULL)

Arguments:

#' Webshot a widget and place it in place with markdown syntax
#'
#' @param widget a html widget, i.e. generated by wordcloud2 pacakge
#' @param path figure webshot storage place
#'
#' @return
#' @export
#'
#' @examples
library(wordcloud2)
markdown_widget <- function(widget,path=getwd(),filename="file.png"){
  require(htmlwidgets)
  require(webshot)
  saveWidget(widget,"tmp.html",selfcontained = F)
  file <- paste(path,filename,sep = "/")
  webshot("tmp.html",file,delay = 5,vwidth = 1024,vheight = 768)
  file.remove("tmp.html")
  paste0("![",file,"](",file,")\n\n") %>% cat()
}

英语版本

library(wordcloud2)
wordcloud2(demoFreq, size = 1,shape = 'circle')
wordcloud2(demoFreq, size = 1,shape = 'cardioid')
wordcloud2(demoFreq, size = 1,shape = 'diamond')
wordcloud2(demoFreq,size = 1,shape = 'triangle-forward')
wordcloud2(demoFreq, size = 1,shape = 'triangle')
wordcloud2(demoFreq, size = 1,shape = 'pentagon')
wordcloud2(demoFreq, size = 1,shape = 'star')
wordcloud2(demoFreq, size = 1, minRotation = -pi/2, maxRotation = -pi/2,shape = "star")
wordcloud2(demoFreq,
           size = 2, 
           minRotation = -pi/6, 
           maxRotation = -pi/6,
           rotateRatio = 1)

中文版本

wordcloud2(demoFreqC,
           size = 2, 
           fontFamily = "微软雅黑",
           color = "random-light",
           backgroundColor = "grey")
wordcloud2(demoFreqC,
           size = 0.8, 
           fontFamily = "微软雅黑",
           color = "random-light",
           backgroundColor = "grey",shape = "star"
          )

letterCloud函数

letterCloud(demoFreq, word = "R")
letterCloud(demoFreq, word = "Python")
letterCloud(demoFreq, word = "WORDCLOUD2")

其它资料

CRAN

wordCloud