Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot script disappear after creation

Tags:

gnuplot

I have a gnuplot script. My system is ubuntu 14.04. When In the terminal I type gnuplot myPlot. The plot will disappear. It is not remain on the screen. I this stack in saw similar question. But its system is windows. I want to know is there any solution for that on ubuntu 14.04 32 bit

PS: when I use gnuplot>-- I mean when I do not use script file-- I see the diagram and it does not disappear.

PS2 : this is my simple gnuplot script file :

set boxwidth 0.5
set style fill solid
plot "dataFile" using 1:2:xtic(2) with boxes
like image 656
alex Avatar asked Jul 29 '14 05:07

alex


People also ask

Is gnuplot suitable for scripting?

1.4 Is gnuplot suitable for scripting? Yes. Gnuplot can read in files containing additional commands during an interactive session, or it can be run in batch mode by piping a pre-existing file or a stream of commands to stdin.

How do I save a gnuplot file?

There are two ways to save your work in gnuplot: you can save the gnuplot commands used to generate a plot, so that you can regenerate the plot at a later time. Or you can export the graph to a file in a standard graphics file format, so that you can print it or include it in web pages, documents, or presentations.

How do I save a gnuplot file as a PNG?

png output) gnuplot> set output "printme. png" (output to any filename. png you want) gnuplot> replot gnuplot> set term x11 You can view it with some viewer, or on a browser, or print it... or import it in PowerPoint or whatever you want to do with it.

Does gnuplot support multiple Y axes on a single plot?

5.9 Does gnuplot support multiple y-axes on a single plot? Yes. 2D plots can have separate x axes at the bottom (x1) and top (x2), and separate y axes at the left (y1) and right (y2).


3 Answers

If you want the plotting window to remain open, you must call gnuplot with the -persist flag:

gnuplot -persist myPlot
like image 121
Christoph Avatar answered Oct 04 '22 17:10

Christoph


There are already nice answers here, but the -persist flag did not work for me and enabling x11 force GnuPlot to use crapy XQuarts for windowing instead of beloved Qt. What worked for me was the

pause -1

command (from here) at the end of the script. According to the documentation

pause -1 # Wait until a carriage return is hit

I hope it helps.

like image 43
Foad S. Farimani Avatar answered Oct 04 '22 19:10

Foad S. Farimani


If you do not want to call gnuplot with the extra argument (-persist), you can enable this functionality within your script, e.g.

set term x11 persist
like image 35
phadjido Avatar answered Oct 04 '22 17:10

phadjido