Gnuplot Help (Simple Text Command Examples) Compiled by Rainer Spurzem WS08 for UKNum Block Course Feb. 2-13 gnuplot> plot sin(x) gnuplot> plot 'myfile.txt' using 1:2 with lines myfile.txt contains data in columns 1,2,... gnuplot> plot 'myfile.txt' using 1:2 with lines gnuplot> plot 'myfile.txt' using 1:2 title 'ABC' with points pointsize 2 pointtype 1 try varying pointsize, pointtype shortcuts always possible gnuplot> plot 'myfile.txt' u 1:2 w l gnuplot> plot 'myfile.txt' u 1:2 t 'ABC' w p ps 2 pt 1 operations with data, always use $: gnuplot> plot 'myfile.txt' u 1:(-$2) w l gnuplot> plot 'myfile.txt' u 1:(-$2) w l, '' u 1:($2+5.*$3) w l second line in one plot, '' refers to first file, can also use different file gnuplot> plot 'myfile.txt' u :1 w l gnuplot> plot 'myfile.txt' u 0:1 w l gnuplot> plot 'myfile.txt' u ($0**2):1 w l empty field, 0, $0 refer to line number of data file as plot coordinate self-defined functions in gnuplot: gnuplot> f(x) = x**2 - x**3 gnuplot> g(x) = exp(-x**2) gnuplot> f2(x) = a*x + b use variables, plot combinations of data and functions gnuplot> a=5.;b=2. gnuplot> plot 'myfile.txt' u 1:2 w l, f(x), g(x) the high level language with conditions on data gnuplot> plot 'myfile.txt' u ($3 > 1.e-05 ? $1 : 1/0):2 w l explanation: plot column 2 against column 1 ($1) from myfile.txt, use only points where the value in column 3 is larger than 1.e-05 otherwise use value undefined 1/0 (no point plotted) much more complex logic possible gnuplot> splot 'myfile.txt' u 1:2:3 w l three-dimensional plot, you can manipulate view with mouse output files: gnuplot> set terminal postscript solid enhanced gnuplot> set output 'myfile.ps' ...all gnuplot commands after set output come into the ps-file... ...until... gnuplot> set terminal x11 ...go back to terminal window... gnuplot> set terminal x11 1 ...use more than one terminal window... Also possible e.g. gnuplot> set terminal gif [... or jpg, png,...] gnuplot> set output 'myfile.gif' ... Creating and using scriptfiles: ... gnuplot> save 'myfile.plt' saves status of last plot in (readable) gnuplot script myfile.plt gnuplot> load 'myfile.plt' reproduce saved plot... Some selected important set options: gnuplot> set logscale x gnuplot> unset logscale x gnuplot> set xrange [0:100] use of * as wildcard possible gnuplot> set xlabel 'abc' gnuplot> set xlabel '{/Symbol D}' produce in postscript output Greek Delta. gnuplot> set xlabel '{/Symbol e}_{fin}' produce in postscript a subscript gnuplot> set grid gnuplot> set title 'ABC' gnuplot>