Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot in java using renjin

Tags:

java

r

swing

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?

like image 445
Sebastian Zeki Avatar asked Feb 13 '26 03:02

Sebastian Zeki


1 Answers

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.

like image 99
D Greenwood Avatar answered Feb 14 '26 17:02

D Greenwood