Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在JavaPlot中保存svg或esp文件_Java_Svg_Plot_Gnuplot_Javaplot - Fatal编程技术网

如何在JavaPlot中保存svg或esp文件

如何在JavaPlot中保存svg或esp文件,java,svg,plot,gnuplot,javaplot,Java,Svg,Plot,Gnuplot,Javaplot,我尝试了保存找到的png文件的代码,效果很好。 但是我想保存一个矢量图像,所以我将终端更改为:PostscriptTerminal和SVGTerminal。对于SVGTerminal,输出为空,当我使用PostscriptTerminal时,代码挂起在p.plot() 我设法保存了一个.eps文件。我只需要在构造函数中添加一个文件路径就可以了 PostscriptTerminal eps = new PostscriptTerminal("output.eps"); PlotStyle

我尝试了保存找到的png文件的代码,效果很好。 但是我想保存一个矢量图像,所以我将终端更改为:PostscriptTerminal和SVGTerminal。对于SVGTerminal,输出为空,当我使用PostscriptTerminal时,代码挂起在
p.plot()


我设法保存了一个.eps文件。我只需要在构造函数中添加一个文件路径就可以了

PostscriptTerminal eps = new PostscriptTerminal("output.eps");

    PlotStyle myPlotStyle = new PlotStyle();
    myPlotStyle.setStyle(Style.POINTS);
    myPlotStyle.setPointType(7); // 7 - circle
    myPlotStyle.setLineType(3); // blue color

    JavaPlot p = new JavaPlot();
    p.setPersist(false);
    p.setTerminal(eps);
    p.getAxis("x").setLabel("X axis", "Arial", 15);
    p.getAxis("y").setLabel("Y axis","Arial", 15);
    p.setKey(JavaPlot.Key.TOP_RIGHT);

    double[][] front = this.writeObjectivesToMatrix();
    DataSetPlot s = new DataSetPlot(front);
    s.setPlotStyle(myPlotStyle);
    s.setTitle("");
    p.addPlot(s);
    p.plot(); 
PostscriptTerminal eps = new PostscriptTerminal("output.eps");

    PlotStyle myPlotStyle = new PlotStyle();
    myPlotStyle.setStyle(Style.POINTS);
    myPlotStyle.setPointType(7); // 7 - circle
    myPlotStyle.setLineType(3); // blue color

    JavaPlot p = new JavaPlot();
    p.setPersist(false);
    p.setTerminal(eps);
    p.getAxis("x").setLabel("X axis", "Arial", 15);
    p.getAxis("y").setLabel("Y axis","Arial", 15);
    p.setKey(JavaPlot.Key.TOP_RIGHT);

    double[][] front = this.writeObjectivesToMatrix();
    DataSetPlot s = new DataSetPlot(front);
    s.setPlotStyle(myPlotStyle);
    s.setTitle("");
    p.addPlot(s);
    p.plot();