Skip to content
Prev 75618 / 398502 Next

Image from bytes streams

The R graphics is not sent to the standard output of the R process, 
which you assume when you try to "capture" it via your Java 'input' 
stream.  Simple illustration:

C:\>echo plot(1) | R --quiet --no-save
 > plot(1)
 >
C:\>

So where did the graphics go then?  If you "batch" run R commands like 
this, all graphical output is written to (one) default postscript file 
"Rplots.ps"; that's the file you want to read.  I bet you have a two 
page Rplots.ps file for your pie and scatter plot.  If you do not want 
postscript, but other formats, you have to generate you image files 
explicitly, e.g.

png("image.png", width=640, height=480)
plot(1)
dev.off()

Make sure you understand how R works before you try to call it from 
Java; there is nothing magic going on if you understand it.

Cheers

Henrik Bengtsson
M??rcio de Medeiros Ribeiro wrote: