[kepler-dev] RExpression image output
Tristan King
tristan.king at jcu.edu.au
Wed Dec 5 15:53:24 PST 2007
On Wed, 2007-12-05 at 11:28 -0800, Dan Higgins wrote:
> Another option is to override the RExpression code that sets the
> graphicsDevice by setting the device to whatever you want in your
> RExpression script. ie simply add a statement like
> bitmap(file='FileName.bmp', width=640, height=640)
> to the beginning of the script. This changes the graphicsDevice to a
> 'bitmap' and puts it into a file name 'FileName.bmp' (rather than the
> default graphics port file name). You can thus customize output using
> the script rather than changing RExpression Java code.
This was what I originally wanted to do, but from what i could tell,
since the fire() code add's the png() call at the start of each script,
it crashes R before it can get to any other calls.
i.e.
> setwd('/home/tristan/projects/jcu/WebPortal/storage/jobs/18/')
> png(filename = 'RExpression1.png',width = 480, height = 480, pointsize = 12, bg = 'white')
Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, :
unable to start device PNG
In addition: Warning message:
unable to open connection to X11 display '' in: png(filename = "RExpression1.png", width = 480, height = 480,
Execution halted
So no matter what i put in the RExpression, it will always die on me.
I thought about extending the actor itself, but it would pretty much be
a copy+paste of the entire fire() method for a single change (and would
be a pain keeping it up to date with the original actor).
maybe the answer is creating a few more values for graphicsFormatString,
i.e. png-ps and png-x11, or something along those lines. That would work
well for me, as i can always force png-ps if png-x11 is selected.
pdf isn't a great solution for me, as i'm trying to embed the output
into a web page, and i don't think (tho i will check) that the img tag
works with pdfs (tho i'm sure browser compatibility for display of pdfs
will ruin it even if it does).
More information about the Kepler-dev
mailing list