Gnuplot » Historique » Révision 4
Révision 3 (François Rioult, 03/02/2011 20:14) → Révision 4/5 (François Rioult, 03/02/2011 20:15)
h1. Gnuplot
h2. Synopsis
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.
h2. Parameters
None.
h2. Inputs
2 input files :
* the first is the @GNUplot@ script. This script uses a @@file@@ string, that is dynamically replaced with the real name by the script. Example
<pre>set title "complexite de l'extraction des frequents"
set logscale
set style data lines
set xlabel 'support minimum'
set ylabel 'nombre de frequents'
set y2tics
set y2label 'temps extraction en s.'
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'
</pre>
* the second is the data to be plot.
h2. Outputs
1 output: the .PNG image representing the plot.
h2. Shell Code
<pre>
#!/bin/bash
# this shell uses gnuplot with the script as first input on the data
# on the second output
# the @file@ string in the gnuplot script is replaced by the data file.
script=$1; shift
data=`echo $1 | sed 's/\//\\\\\//g'`; shift
output=$1; shift
(
echo "set terminal png"
echo "set output '$output'"
sed "s/@file@/$data/g" $script
) > $script.plot
gnuplot $script.plot
rm $script.plot
</pre>
h2. Example
This operator is used plotting the results in the stream [[Data mining complexity]].