i try to get an Image out of Mathematica. I try to evaluate some Mathematica Code that uses Methods in Packages to generate Graphics. If i paste the Code to a Mathematica Notebook the Graphic is generated correctly.
So my Question:
How do I get this graphics to Java ???
Here is my Sample Code:
ml = MathLinkFactory.createKernelLink("-linkmode launch -linkname 'F:\\APPS\\Wolfram
Research\\Mathematica\\7.0\\mathkernel.exe'");
ml.addPacketListener(new MyPacketListener());
ml.discardAnswer();
PacketListener stdoutPrinter = new PacketPrinter(System.out);
ml.addPacketListener(stdoutPrinter);
// In stringList there is all the INPUT for Mathematica
for (int i = 0; stringList.size() > i; i++)
{
System.out.println("Input" + "[" + i + "]" + stringList.get(i));
ml.evaluate(stringList.get(i));
ml.discardAnswer();
}
ml.close();
class MyPacketListener implements PacketListener {
public boolean packetArrived(PacketArrivedEvent evt)
throws MathLinkException {
if (evt.getPktType() == MathLink.TEXTPKT) {
KernelLink ml = (KernelLink) evt.getSource();
System.out.println(ml.getString());
}
return true;
}
The Output is:
<<CIP`ExperimentalData`
<<CIP`MLR`
dataSet = CIP`ExperimentalData`GetQSPRDataSet02[];
CIP`Graphics`ShowDataSetInfo[{"IoPairs", "InputComponents", "OutputComponents"},
dataSet];
Number of IO pairs = 2169
Number of input components = 130
Number of output components = 1
mlrInfo = CIP`MLR`FitMlr[dataSet];
mlrInfoInInputForm = InputForm[mlrInfo];
pointSize = 0.025;
CIP`MLR`ShowMlrSingleRegression[{"ModelVsDataPlot", "CorrelationCoefficient"},
dataSet, mlrInfo, GraphicsOptionPointSize -> pointSize];
(*-Graphics-*)
(*
Out 1 : Correlation coefficient = 0.999373
*)
pointSize = 0.01;
CIP`MLR`ShowMlrSingleRegression[{"AbsoluteSortedResidualsPlot",
"AbsoluteResidualsStatistics", "RMSE"},
dataSet, mlrInfo, GraphicsOptionPointSize -> pointSize];
(*-Graphics-
Definition of 'Residual (absolute)': Data - Model
-1
Out 1 : Residual (absolute): Mean/Median/Maximum Value = 1.4 / 9.84 × 10 /
1
> 1.79 × 10
Root mean squared error (RMSE) = 2.063
*)
How do I get these -Graphics- ?
Thanks for the Help!