Pages

Affichage des articles dont le libellé est gnuplot. Afficher tous les articles
Affichage des articles dont le libellé est gnuplot. Afficher tous les articles

mardi 20 mars 2012

plot with errorbars using gnuplot

plot "tt" using 1:5:6  -t "label1" with errorbars, "tt1" using 1:5:6  -t "label2" with errorbars
---- using 1:5:6 means: to use the 1th, 5th and 6th column of data in the file tt and tt1
---- column1 is the x, column 5 for y, and column 6 for error bars

mercredi 7 mars 2012

some useful sites about gnuplot

A collection of useful websites about gnuplot.....
1) http://www.gnuplot.info/demo_canvas/
provides a lot of demonstration of using gnuplot with the LATEST gnuplot version

2) http://physicspmb.ukzn.ac.za/index.php/Gnuplot_tutorial
provides a simple tutorial for start-up

3) http://t16web.lanl.gov/Kawano/gnuplot/intro/basic-e.html
also provides some examples but in version 4.0

4) http://www.phyast.pitt.edu/~zov1/gnuplot/html/index.html

plot in gnuplot4.4

Here are some often-used commands of gnuplot ........


0) help set xlabel
to get help

1) plot "datafile1"  using   index1_of_column_to_be_plotted   t  "titlename", "datafile2"  using   index2_of_column_to_be_plotted   t  "titlename",  " "  using   index3_of_column_to_be_plotted   t  "titlename",


This will plot the column of data with index1_of_column_to_be_plotted from datafile1, where "t" for command title; then plot the column of data with index2_of_column_to_be_plotted from datafile2; then plot the column of data with index2_of_column_to_be_plotted from datafile2 again

2) set xtics Integer
where the integer is the show the tics in a step of Integer

3) set xrange [Int1: Int2]

4) set title "string"

5) set xlabel "string"

6) set terminal jpeg medium
to set the figures to be saved in jpeg format

7) set output "filename"
set the output filename to be saved


A simple summary from http://physicspmb.ukzn.ac.za/index.php/Gnuplot_tutorial is copied below:

Make a titleset title 'Graph of velocity versus time'
Label x axisset xlabel 'Time(s)'
Label y axisset ylabel 'Velocity(m/s\^2)'
Adjust the tick marksset xtics 0.1
set ytics 0.1
Adjust no. of minor tick marksset mxtics 4
Move the keyset key bottom left
set key top right
Change the key textplot sin(x) title "new text"
Remove the keyunset key
Set plot aspect ratioset size square
 :A wide plotset size ratio 0.25
 :A narrow tall plotset size ratio 2
Adjust the xrangeset xrange[-3:5]
Adjust the lower xrange, upper autoset xrange[-3:*]
Adjust the upper xrange, lower autoset xrange[*:5]
Use a logarithmic x axisset logscale x
Use a logarithmic y axisset logscale y
Draw a grid on major ticsset grid y

install or update a software in a server

I work in a server and uses the gnuplot for making figures. I found the gnuplot does not work well with some new functions.

First I tried to find out the version of gnuplot in the server.
1) which gnuplot
/usr/bin/gnuplot
2) /usr/bin/gnuplot --version
4.0
 this is an old version and I want to install the new version. Therefore I go to sourceforge http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.0/ to download the version 4.4,
and put the downloaded file in a temporary directory in my home in the server. Then I tried to install it in the server !

3) To build it:
     ./configure --PREFIX=$HOME/software
Because I do not have permission to install software in/usr/local, I use --PREFIX=$HOME/software  to install it in this path.
     make
6) test it
     make check
7) install it
     make install

8) finally I add an alias in the .bashrc and .tcshrc (and the .tcshrc_profile)
alias gnuplot4="/home/username/software/bin/gnuplot"
add in the .tcshrc (and the .tcshrc_profile)
alias   gnuplot4    home/username/software/bin/gnuplot
I also add the GNUPLOT_PS_DIR in the tcshrc and bashrc.
set GNUPLOT_PS_DIR = /home/username/software/


9) when I try to call a gnuplot program,
gnuplot4    histogram.plt