Gnuplot » Historique » Version 5
François Rioult, 03/02/2011 20:27
| 1 | 1 | François Rioult | h1. Gnuplot |
|---|---|---|---|
| 2 | |||
| 3 | 5 | François Rioult | !https://forge.greyc.fr/attachments/61/gnuplot.png! |
| 4 | |||
| 5 | 1 | François Rioult | h2. Synopsis |
| 6 | |||
| 7 | This operator has no parameter, two inputs (the GNUplot script and the data) and one output (the plot). It launches GNUplot for generating a .PNG image. |
||
| 8 | |||
| 9 | h2. Parameters |
||
| 10 | |||
| 11 | None. |
||
| 12 | |||
| 13 | h2. Inputs |
||
| 14 | |||
| 15 | 2 | François Rioult | 2 input files : |
| 16 | 4 | François Rioult | * the first is the @GNUplot@ script. This script uses a @@file@@ string, that is dynamically replaced with the real name by the script. Example |
| 17 | <pre>set title "complexite de l'extraction des frequents" |
||
| 18 | set logscale |
||
| 19 | set style data lines |
||
| 20 | set xlabel 'support minimum' |
||
| 21 | set ylabel 'nombre de frequents' |
||
| 22 | set y2tics |
||
| 23 | set y2label 'temps extraction en s.' |
||
| 24 | plot '@file@' using 1:2 title 'nombre de frequents' axis x1y1, '@file@' using 1:3 title 'temps extraction' axis x1y2, '@file@' using 1:($2/$3) title 'rapport temps/frequent' |
||
| 25 | </pre> |
||
| 26 | 2 | François Rioult | * the second is the data to be plot. |
| 27 | 1 | François Rioult | |
| 28 | h2. Outputs |
||
| 29 | |||
| 30 | 1 output: the .PNG image representing the plot. |
||
| 31 | |||
| 32 | h2. Shell Code |
||
| 33 | |||
| 34 | <pre> |
||
| 35 | #!/bin/bash |
||
| 36 | |||
| 37 | # this shell uses gnuplot with the script as first input on the data |
||
| 38 | # on the second output |
||
| 39 | # the @file@ string in the gnuplot script is replaced by the data file. |
||
| 40 | |||
| 41 | script=$1; shift |
||
| 42 | data=`echo $1 | sed 's/\//\\\\\//g'`; shift |
||
| 43 | output=$1; shift |
||
| 44 | |||
| 45 | ( |
||
| 46 | echo "set terminal png" |
||
| 47 | echo "set output '$output'" |
||
| 48 | sed "s/@file@/$data/g" $script |
||
| 49 | ) > $script.plot |
||
| 50 | |||
| 51 | gnuplot $script.plot |
||
| 52 | rm $script.plot |
||
| 53 | </pre> |
||
| 54 | |||
| 55 | h2. Example |
||
| 56 | |||
| 57 | This operator is used plotting the results in the stream [[Data mining complexity]]. |