You can create a script by hand using any text editor or you can have gnuplot save a record of what you have done with the command
save "script-name"which writes all relevant commands leading to the most recent plot into the specified file.
To use a script, either place its name on the gnuplot command line, or enter the command
load "script-name"at the gnuplot prompt.
A typical simple script might look like:
set title "overall label" set xlabel "time" set ylabel "data" set nokey # turn keys off -- this is a comment, by the way! plot [1:13] [-1:1] "data1" every 4 using 1:3 with pointsRun it by typing
gnuplot -persist script-name
#!/usr/local/bin/gnuplot -persistat the start, and making the script executable:
chmod a+x script-nameThe initial line tells Linux how to run the script. This approach has several advantages -- for example you can pipe data into the script and simply have plot use "-" as a file name, avoiding any need to know the data file name in advance.