搜索
查看: 2187|回复: 1

R package wordcloud 与color in R

[复制链接]

11

主题

14

帖子

178

积分

版主

Rank: 7Rank: 7Rank: 7

积分
178
发表于 2017-6-2 10:30:01 | 显示全部楼层 |阅读模式
本帖最后由 polya 于 2017-6-2 10:29 编辑

wordcloud :
功能:词频工具
应用:展示文本中出现关键词的频率

格式:
wordcloud(words,freq,scale=c(4,.5),min.freq=3,max.words=Inf,
        random.order=TRUE, random.color=FALSE, rot.per=.1,
        colors="black",ordered.colors=FALSE,use.r.layout=FALSE,
        fixed.asp=TRUE, ...)
参数解析:
words
        词集向量
freq
        词频
scale
        词集范围
min.freq
       词频下限
max.words
       词集最大数量
random.order
       随机排列
random.color
      随机颜色
rot.per
      proportion words with 90 degree rotation
colors
        color words from least to most frequent
ordered.colors
        if true, then colors are assigned to words in order
use.r.layout
       if false, then c++ code is used for collision detection, otherwise R is used
fixed.asp
       if TRUE, the aspect ratio is fixed. Variable aspect ratio only supported if rot.per==0

测试代码
[AppleScript] 纯文本查看 复制代码
#Charge the wordcloud library
library(wordcloud)
#Create a list of words (Random words concerning my work)
sa=c("bioisland","RNAseq","Sagene","Experimentation","Talk","Conference","Writing", 
    "Publication","Analysis","illumina","Science","Statistics","Data genome", 
    "gene","Wheat","Virus","Genotyping","Work","professor","Surfing","R", "Internet",
    "Data-visual","Python","Linux","Programming","Graph Gallery","Biologie", "Resistance","School","professor",
    "Computing","Data-Science","Higher","Hiseq","PE150","chipseq","DNA","medip","BSA","human genome")

#I give a frequency to each word of this list 
gene=sample(seq(0,1,0.01) , length(sa) , replace=TRUE) 
gene
#The package will automatically make the wordcloud ! (I add a black background)
par(bg="darkblue") 
wordcloud(sa , gene , col=cm.colors(length(sa) , alpha=0.8) , rot.per=0.3 )


输出结果




引申篇:
color in R
常用的颜色选择
terrain.colors
rainbow
cm.colors
topo.colors
heat.colors

参照颜色版:
https://www.nceas.ucsb.edu/~fraz ... letteCheatsheet.pdf
参考资料:https://www.rdocumentation.org/p ... .5/topics/wordcloud

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x



上一篇:揭开SCN2A的神秘面纱 ———浅谈抗癫痫药物治疗效果的异...
下一篇:illumina的450K芯片的beta值含义及计算方法
回复

使用道具 举报

634

主题

1182

帖子

4030

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4030
发表于 2017-7-10 08:41:58 | 显示全部楼层
你这个问题很复杂,需要打赏,请点击 http://www.bio-info-trainee.com/donate 进行打赏,谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树 ( 粤ICP备15016384号  

GMT+8, 2019-7-18 09:33 , Processed in 0.030619 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.