javarswingrenjin

How to plot in java using renjin


I've recently discovered renjin and its great at making R easy to use in java. However I'm having some issues with my main use of R, which is data visualisation, and getting the R plots into my swing application. My aim is to simply allow the user to run an R script from the swing application and for the resulting ggplot2 grpah to be shown in the swing panel. I have used

textPane.setText(engine.eval(new java.io.FileReader("/Users/sebastianzeki/Desktop/TBBdf.R")).toString());

in order to provide a text output to a textPane but how would I go about showing a graph and in what kind of pane?


Solution

  • Unfortunately, ggplot2 and most other graphics packages do not currently work with renjin. This is due to compatibility issues arising from trying to compile the original source code of some packages into java bytecode.

    The renjin project is ongoing however, and you can view announcements on the availability of packages on the renjin blog.