GNUPlot disappears immediately after its creation

I created gnuplot , but the problem is that it disappears right away. I tried different solutions offered in other threads, but none of them worked. Solution 1: comment out the line bf.append("quit").append(NL); in the GNUPlotParameters.java file. Solution 2: put the line gp.setPersist(true); to gp.plot(); .

 DataSetPlot plotdata = new DataSetPlot(Xvals); plotdata.setTitle(""); GNUPlot gp = new GNUPlot("C:\\Program Files (x86)\\gnuplot\\bin\\pgnuplot.exe"); gp.addPlot(plotdata); gp.plot(); gp.setPersist(true); 

So how to solve this problem?

PS I am running this code on Windows 7.

+4
source share
2 answers

Unfortunately, this seems like a bug in gnuplot under windows. See this bug report .

If you want to use this type of function, you have two options:

  • use CygWin version of gnuplot
  • save the result to a file or use JPlot .

EDIT . There is a new version of JavaPlot that should fix this problem.

+1
source

Look at the -persist parameter to go to gnuplot, you can probably change the third line in your code to

 GNUPlot gp = new GNUPlot("C:\\Program Files (x86)\\gnuplot\\bin\\pgnuplot.exe -persist"); 

or

 GNUPlot gp = new GNUPlot("C:\\Program Files (x86)\\gnuplot\\bin\\pgnuplot.exe /noend"); 

Here is my source.

-1
source

Source: https://habr.com/ru/post/973013/


All Articles