使用wordcloud包,我需要使字云调整成矩形形状。创造文字云本身并不是一个问题。我使用的是自定义函数:
createCorpus <- function (name, name2, output) {
# Here comes all the processing for generating a corpus
# irrelevant for this question
# Create wordcloud and save the image in png format
png(output, width=7.5, height=5, units="cm", res=140, bg = "white")
wordcloud(ordered.colors=TRUE,
words = topfeatures$keyName,
freq = topfeatures$value.x,
scale=c(1,.5),
min.freq=2,
max.words=10,
random.order=T,
rot.per=.0)
dev.off()
}运行该函数(f.i.:)
createCorpus(标记监视$Content,"termsmm","wcMM.png")
结束生成带有字云的png。然而,所有这些字云的形状似乎都是圆形的。然而,在我的规范中,我需要创建矩形字云。F.i:

考虑到,对于前面的图像,我手动调整了“循环”字云的大小。
我开始将rot.per参数更改为.0,从而防止了单词的垂直输出。然而,这似乎没有帮助。只要限制输出的高度(f.i.:png(output, width=7.5, height=2.5, units="cm", res=140, bg = "white")),就会得到以下错误:
plot.new()中的错误:图形边距太大
问:,我可以用圆型以外的形状在R中制造字云吗?
发布于 2016-12-13 12:14:26
根据我过去几个小时的个人经验,这是不可能的。
我读过一个字云包描述,没有任何参数可以设置为使wordcloud水平。
https://stackoverflow.com/questions/41118798
复制相似问题