run<-1 updateDataSet <- function(run) { aChar<-character(1) aChar<-as.character(run) dsname<-c(paste("DataCulture",aChar,sep="")) data<-read.table(dsname,header=T,as.is = TRUE) } buildGraph <-function(data) { tmp1<-plot(data$acquaint~data$T,type='l', ylim=c(0,1),ylab="average proportion",xlab="PERIOD",lty=1,pch=1,main="") par("new"=TRUE) tmp2<-plot(data$harmony~data$T,type='l', ylim=c(0,1),ylab="average proportion",xlab="PERIOD",lty=2,pch=1,main="") par("new"=TRUE) tmp3<-plot(data$identical~data$T,type='l', ylim=c(0,1),ylab="average proportion",xlab="PERIOD",lty=3,pch=1,main="") par("new"=TRUE) tmp4<-plot(data$totalEntropy~data$T,type='l',ylim=c(0,1),ylab="",xlab="",lty=4,pch=1,main="", cex=10) #want a legend? #legend(max(data$T)/2,0.2,c("Acquaintance","Harmonious","Identical","Entropy"),lty=1:4,xjust=1,yjust=1) #if you want to interact, do this: #legend(locator(1),c("Acquaintance","Harmonious","Identical"),lty=1:3) #or do this to place the lables, one after the other text(locator(4),c("Acquaintance","Harmony","Identical","Entropy")) } redraw<-function() { dsname<-updateDataSet(run) buildGraph(dsname) } new<-function() { dsname<-updateDataSet(run) buildGraph(dsname) run <<- run+1 } new()