User Tools

Site Tools


wiki:gnurun

Running gnuplot

Exercise:
Script: open by kate ~/ost4sem/exercise/basic_adv_gnuplot/gnuplot.sh
Data: ~/ost4sem/exercise/basic_adv_gnuplot/input.txt
Directory: ~/ost4sem/exercise/basicadvgnuplot/

kate ~/ost4sem/exercise/basic_adv_gnuplot/gnuplot.sh &

From the bash command line

You can run gnuplot directory from the bash command line typing command by command
Example:

gnuplot
set xrange [2000:14000] 
splot 'input.txt'   u 3:4:5

This way it is very useful to explore your data.

From a script

If you need to automate a process it is better to create a script that can be run by the shell many times. It can be run by:
gunplot < myscriptplot.plt
Example:
Create a simple gnuplot script in a text editor using the following commands:

set terminal postscript eps color solid lw 4 “Helvetica” 24
set view 80,100
set output 'countryname.ps'
splot 'input.txt' u 3:4:5

save it to
myscriptplot.plt.

Run it by:
<code bash> gunplot < myscriptplot.plt evince countryname.ps </code>
If you need to insert a serial of gnuplot commands inside a bash script you can use the following syntax:

gnuplot «EOF
….
….
EOF

Example:
Create a simple bash-gnuplot script in a text editor using the following command:

grep IT avermonthnuts3.asc > avermonthIT.asc
gnuplot « EOF
set terminal postscript eps color solid lw 4 “Helvetica” 24
set view 80,100
set output 'countryIT.ps'
splot 'aver
monthIT.asc' u 3:4:5
exit
EOF
rm aver
monthIT.asc

save it to
bash
gnuplotscript.sh

Run it by:
<code bash> sh bashgnuplotscript.sh </code>

wiki/gnurun.txt · Last modified: 2017/12/05 22:53 (external edit)