Lchiffon / wordcloud2

R interface to wordcloud for data visualization.
397 stars 113 forks source link

color: support array #2

Closed badbye closed 8 years ago

badbye commented 8 years ago
library(REmap)
data = data.frame(iconv(chinaIphone$V1,from="GBK",to = "UTF-8"),chinaIphone$V2)
# pass a vector of color
wordcloud2(data, 
    color = rep(c('red', 'yellow'), length.out=nrow(data)), fontWeight = "bold")

# one more example
wordcloud2(data, 
    color = ifelse(data[, 2] > 500, 'red', 'yellow'), fontWeight = "bold")