[kepler-dev] small patch for R actor

Dan Higgins higgins at nceas.ucsb.edu
Tue May 29 14:12:50 PDT 2007


Hi Daniel,

    Your suggestion brings up some interesting questions.

    First of all, I had not really looked at the R 'bitmap()' function 
before. As I understand the documentation, its use requires 
'ghostscript' on the executing machine. If so, that means that it would 
not work on many machines. (I doubt if most of our Windows users have it 
installed.) (Actually I should try it on Windows to find out!)

    I don't think I agree with adding a 'png without X11' choice for the 
graphicsFormat because many of our users will have no idea just what X11 
is! (On Windows, the png option does not use X11.)

    Can you use the pdf option on your server? That seems a better 
choice to me because the output can be resized better than bitmaps.

   Also, it should be noted that a user of the RExpression actor can 
always change the display device inside the script and avoid having to 
change the actor's Java code; i.e. simply add the bitmap() function to 
the beginning of the user script to override the default set in the 
actors parameters.

     So I guess I would rather not increase the complexity of the R 
actor itself unless we can do it in a way that works across all 
platforms and does not require additional software installation.




Dan Higgins
NCEAS



Daniel Crawl wrote:
>
> Hi Dan,
>
> Efrat and I are using the R actor in workflows being executed via a 
> web server.
> Since X11 is not available, png() doesn't work. Attached is a small 
> change I made
> to the R actor to allow png output via bitmap(). It adds a third 
> choice to the
> graphicsFormat parameter: "png without X11". Instead maybe it would be 
> cleaner
> to make a new boolean parameter useX11?
>
> If you want, I'll add the parameter and commit the changes...
>
> Thanks,
>
>  --dan
>
>
> ------------------------------------------------------------------------
>
> Index: RExpression.java
> ===================================================================
> RCS file: /cvs/kepler/src/org/ecoinformatics/seek/R/RExpression.java,v
> retrieving revision 1.47
> diff -r1.47 RExpression.java
> 206a207
>   
>>         graphicsFormat.addChoice("png without X11");
>>     
> 317c318,322
> <         graphicsOutputFile = getUniqueFileName(graphicsFormatString);
> ---
>   
>>         if(graphicsFormatString.equals("png without X11")) {
>>             graphicsOutputFile = getUniqueFileName("png");
>>         } else {
>>             graphicsOutputFile = getUniqueFileName(graphicsFormatString);
>>         }
>>     
> 327c332
> < 	  } else {
> ---
>   
>> 	  } else if (graphicsFormatString.equals("png")) {
>>     
> 328a334,335
>   
>> 	  } else if (graphicsFormatString.equals("png without X11")) {
>>             graphicsDevice = "bitmap(file = '"+ graphicsOutputFile + "'"+",width = "+nxd+", height = "+nyd+", pointsize = 12, bg = 'white')";		  
>>     




More information about the Kepler-dev mailing list