R中的离散图

R中的离散图,r,plot,text-mining,R,Plot,Text Mining,我面临以下问题。 我有12个文本,我需要创建一个分散图,其中一个。我想让R一起显示几个分散图。现在我有了我需要的所有信息,我能够创建单独的分散图。我只是不知道如何将它们全部绘制在一起,正如这里所解释的()。这是我的密码: input.dir<-"corpus" files.v<-dir(input.dir, "\\.txt$") make.file.word.v.l<-function(files.v, input.dir){ text.word.

我面临以下问题。 我有12个文本,我需要创建一个分散图,其中一个。我想让R一起显示几个分散图。现在我有了我需要的所有信息,我能够创建单独的分散图。我只是不知道如何将它们全部绘制在一起,正如这里所解释的()。这是我的密码:

    input.dir<-"corpus"
    files.v<-dir(input.dir, "\\.txt$")

    make.file.word.v.l<-function(files.v, input.dir){
  text.word.vector.l<-list()
  for(i in 1:length(files.v)){
    text.v <- scan(paste(input.dir, files.v[i], sep="/"), what="character", sep="\n")
    Encoding(text.v)<-"UTF-8"
    text.v <- paste(text.v, collapse=" ")
    text.lower.v <- tolower(text.v)
    text.words.v <- strsplit(text.lower.v, "\\W")
    text.words.v <- unlist(text.words.v)
    text.words.v <- text.words.v[which(text.words.v!="")]
    text.word.vector.l[[files.v[i]]] <- text.words.v
  }
  return(text.word.vector.l)
}

corpus.l<-make.file.word.v.l(files.v, input.dir)

input.dir我找到了答案。您只需设置标准杆:

par(mfrow =c(4,3))
options(scipen=5)
plot(noches.todos[[1]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[2]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[3]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[4]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[5]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[6]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[7]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[8]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[9]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[10]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[11]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[12]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
您还可以使用选项(scipen)来避免使用科学符号。 我无法在一列中绘制所有绘图的R图,但我能够获得良好的图像。行的图形显示可能有限制。mfrow中的第一个数字(在我的示例4中)设置行数,第二个数字(在我的示例3中)设置列数。这意味着您将得到每行3个图,即12个图形

par(mfrow =c(4,3))
options(scipen=5)
plot(noches.todos[[1]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[2]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[3]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[4]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[5]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[6]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[7]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[8]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[9]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[10]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[11]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')
plot(noches.todos[[12]], main="Dispersion plot",
     xlab="time", ylab="keyword", type="h", ylim=c(0,1), yaxt='n')