[R] Multiple Figure environment through Java

From: Vasundhara Akkineni <vasu.akkineni_at_gmail.com>
Date: Sat 10 Dec 2005 - 03:44:06 EST


I am trying to create a .jpg file with multiple graphs on it. I am creating this file through a java servlet which connects to R using RServe. In the code below, col is an int array which has a list of the col numbers of the data file whose data i have to use for plotting.

c=new Rconnection();

   c.voidEval("data<-read.table(\"table50.txt\",header=TRUE,sep=\"\t\")");    REXP xp=c.eval("jpeg(\"plot_2.jpg\")");

   c.voidEval("par(mfcol=c("+col.length+","+col.length+"))");
   c.voidEval("par(oma=c(2,0,3,0))");
   c.voidEval

("totnorm<-function(x,y){scale<-sum(x)/sum(y);xlab<-colnames(x);ylab<-colnames(y);x1<-x[[1]];y1<-scale*y[[1]];plot(x1,y1,xlab=xlab,ylab=ylab,col=6,
col.lab=4);}");

   for(int i=0;i<col.length;i++)
   {
    for(int j=0;j<col.length;j++)
    {
     c.voidEval
("par(mfg=c("+(i+1)+","+(j+1)+","+col.length+","+col.length+"))");

     c.eval("totnorm(data["+col[i]+"],data["+col[j]+"])");     }
   }

 I am able to plot a 4*4 matrix of plots(16 plots), but when i try to plot for a number greater than that for col.lenght, for eg, 5*5 or 6*6....the rserve.exe just shuts itself close and i get a connection error. I tried doing this manually in R and it worked fine there. How can this be resolved?

Thanks,
Vasu.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Dec 10 03:51:55 2005

This archive was generated by hypermail 2.1.8 : Sat 10 Dec 2005 - 04:24:04 EST