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]]