0

假设我有一个列表名称 Label1 如下

[1] "adelaide"  "allah"     "ampamp"    "anak"      "anwar"     "audit"     "australia" "bajet"    
[9] "baru"      "bersama"   "blog"      "dato"      "doakan"    "dsai"      "eid"       "festival" 

我想把它全部打印到图像(png)上。任何想法?如果可能,还包括顶部的标题。我尝试使用

png(file.choose(), w=700, h=1000)
  par(mar=c(5,10,2,2))
  print(Label1)
dev.close()

但是它只适用于我猜的情节。

4

2 回答 2

2

我会说textplot,甚至一个词云可能会更好,但这里有一个简单的方法可以让你有一些控制......

Label1 = c("adelaide","allah","ampamp","anak","anwar","audit","australia","bajet","baru","bersama","blog","dato","doakan","dsai","eid","festival" )

# set up the empty frame
plot(c(0,100),c(0,100),xaxt='n',yaxt='n',type='n',xlab="",ylab="",
 main = "Image Title")

# set up the positions:
x = rep(seq(20,80,20),4)
y = c(20,20,20,20,40,40,40,40,60,60,60,60,80,80,80,80)

# plot the words using text()
text(x,y,Label1,col=rainbow(12))

输出:

在此处输入图像描述

词云选项的示例:

library(wordcloud)
require(RColorBrewer)
wordcloud(Label1, colors=(rep(brewer.pal(8,"Spectral"),2)), ordered.colors=TRUE)

输出:

在此处输入图像描述

于 2013-10-30T01:52:32.867 回答
1

试试textplotgplots 包。

于 2013-10-30T01:30:30.760 回答