Java rCaller生成空图像和空绘图
我正在尝试一个运行在Windows8、JRE7、RCaller 2.4和R-3.0.2上的eclipse示例。我还测试了R-3.1.1。 但生成绘图时,它显示为空,并且不显示异常或错误。 当我查找生成的绘图时,它的大小为0 kb 我在我的mac os上尝试了同样的代码,一切都很完美 代码:Java rCaller生成空图像和空绘图,java,r,image,plot,rcaller,Java,R,Image,Plot,Rcaller,我正在尝试一个运行在Windows8、JRE7、RCaller 2.4和R-3.0.2上的eclipse示例。我还测试了R-3.1.1。 但生成绘图时,它显示为空,并且不显示异常或错误。 当我查找生成的绘图时,它的大小为0 kb 我在我的mac os上尝试了同样的代码,一切都很完美 代码: RCaller调用者=新的RCaller(); setrscript可执行文件(“C:\\Program\\R\\R-3.0.2\\bin\\Rscript.exe”); RCode代码=新的RCode();
RCaller调用者=新的RCaller();
setrscript可执行文件(“C:\\Program\\R\\R-3.0.2\\bin\\Rscript.exe”);
RCode代码=新的RCode();
code.clear();
//双[]数=新的双[]数{1,4,3,5,6,10};
//
//代码.addDoubleArray(“x”,数字);
文件;
file=code.startPlot();
System.out.println(“绘图将保存到:“+文件”);
addRCode(“x确保您使用的是RCaller-2.0.7.jar或更高版本
参考文献
RCaller caller = new RCaller();
caller.setRscriptExecutable("C:\\Programme\\R\\R-3.0.2\\bin\\Rscript.exe");
RCode code = new RCode();
code.clear();
// double[] numbers = new double[]{1, 4, 3, 5, 6, 10};
//
// code.addDoubleArray("x", numbers);
File file;
file = code.startPlot();
System.out.println("Plot will be saved to : " + file);
code.addRCode("x<-c(1,4,3,5,6,10)");
code.addRCode("plot(x)");
code.endPlot();
caller.setRCode(code);
caller.runOnly();
code.showPlot(file);