Gnuplot

You start the program with
gnuplot

You end the program with
quit

You get help by
help

To get a tutorial
cd "usr/local/gnuplot/demo"
load "all.demo"
Another tutorial can be found in www.me.umn.edu/courses/shortcourses/gnuplot
http://www.menet.umn.edu/docs/gnuplot.html
http://www.cs.dartmouth.edu/gnuplot_info.html

Data should be in a file columnwise

Plot the content of a file in columns 2 (to be x) and 3 (to be y)
plot "file" using 2:3 with lines

Several plots in the same diagram
plot "t1" using 3:4 title "Other", "t2" using 3:4 title "Gly", "b" using 2:3 title " " with lines

To write an output file
set terminal postscript "Times-Roman" 14
set output "file.ps"
replot

To use colours
set terminal postscript color "Times-Roman" 14
set output "file.ps"
replot

portrait can also be used after postscript

To write an output file to be imported by MsWord
load 'script2.gp'
set terminal cgm

set output "file.cgm"
replot
In Word you can then import this file by Insert - Picture - From file

To set lables etc.
set title "Title"
set xlabel "x"
set ylabel "y"
set xrange [-180,180]
set yrange [-180,180]
set xticks -12,4,12
set yticks 0,2,6

To fit data
set dummy ep    (Set the independent variable to ep, rather than x)
f(ep)=mu_1*(1.0-exp(-mu_2*ep))+sy
fit f(eP) 'data_file' using 1:2 via mu_1,mu_2,sy      (Fit to the f(ep) function with three variables)
plot 'data_file' using 1:2,f(ep)      (the fitted parameters are set to the final values by default)

To run shell commands inside gnuplot:
!ls
more commands
!

Ulf Ryde, 19/9-00


3D plots for PCA (Rubus)

  1. Copy the evec file from the Windows machine
  2. Open in textedit and copy to xls (possibly via emacs, owing to problems with EOL)
  3. Select the three first PCs.
  4. Possibly add a small random displacement to identical data:
    =D9+(RAND()-0.5)*0.01
  5. Copy the PC1, PC2 to columns and then PC3-min(PC3)
  6. Construct two vectors:
    The first with (PC1, PC2 and min(PC3))
    The second with (0, 0, PC3-min(PC3)
  7. Divide the data into separate files for each species
  8. Plot with gnuplot using this script:
set xlabel "PC-1"
set ylabel "PC-2"
set zlabel "PC-3"
set xrange [-0.6:0.6]
set yrange [-0.6:0.8]
#set zrange [0.:1.0]
set xyplane at -0.61
set pointsize 0.9
splot "dis" using 8:9:10:11:12:13 with vector nohead lc rgbcolor "blue" notitle ,"pb" using 8:9:10:11:12:13 with vector nohead lc rgbcolor "red"  notitle,"tvd" using 8:9:10:11:12:13 with vector nohead lc rgbcolor "black" notitle,"wt" using 8:9:10:11:12:13 with vector nohead lc rgbcolor "green" notitle,"fa" using 8:9:10:11:12:13 with vector nohead lc rgbcolor "orange" notitle,    "dis" using 1:2:3 with points pt 7  lc rgbcolor "blue" title "dissimulans","pb" using 1:2:3 with points pt 7  lc rgbcolor "red" title "polybracteatus","tvd" using 1:2:3 with points pt 7  lc rgbcolor "black" title "trivultus","wt" using 1:2:3 with points pt 7  lc rgbcolor "green" title "wendtii","fa" using 1:2:3 with points pt 7  lc rgbcolor "orange" title "fasciculatus"


 


Template file for 3D plots

set encoding iso_8859_1
set term postscript eps enhanced colour "Times-Roman"
set output 'plot-scan-3d-graph-abstr.eps'

set key off

set xlabel 'Angle {/Symbol q} (degrees)'
set format x '%4.1f'
set ylabel 'O-O Bond {/Italic R} ({\305})'
set format y '%4.2f'
set zlabel 'Energy (kJ/mol)'
set format z '%.1f'

#set xrange [0:1]
#set yrange [-150:200]
#set xtics 0.1
#set ytics 50

#set contour
#set contour base
#unset surface
#set cntrparam levels 50
set view 60,60,1.1
set pm3d
set palette color

unset colorbox

set label '{/Italic CI}' at screen 0.5, screen 0.605 front

#closed ozone
set label 'O' at screen 0.25, screen 0.9 front
set label 'O' at screen 0.2,  screen 0.8 front
set label 'O' at screen 0.3,  screen 0.8 front
set arrow from screen 0.21, screen 0.813 to screen 0.25, screen 0.89 nohead front lt -1
set arrow from screen 0.298, screen 0.81 to screen 0.258, screen 0.89 nohead front lt -1
set arrow from screen 0.295, screen 0.798 to screen 0.218, screen 0.798 nohead front lt -1

#open ozone
set label 'O' at screen 0.78, screen 0.37 front
set label 'O' at screen 0.85, screen 0.42 front
set label 'O' at screen 0.92, screen 0.37 front
set arrow from screen 0.79, screen 0.38 to screen 0.845, screen 0.415 nohead front lt -1
set arrow from screen 0.92, screen 0.38 to screen 0.868, screen 0.415 nohead front lt -1


splot 'Scan-3d-reduced.plot' u 1:2:(2625.5*($3-(-225.01637325))) w l lt -1


'Scan-3d-reduced.plot:
83.5  1.3973435    -225.01468919   -225.01143802
83.5  1.40275275    -225.01469085   -225.01190439
83.5  1.408162    -225.01463472   -225.01228849

83.625  1.3973435     -225.01457922   -225.01222354
83.625  1.40275275     -225.01460676   -225.01266188
83.625  1.408162         -225.01458676   -225.01301116

...
Luca, 13/2-08