Projet

Général

Profil

Gnuplot » Historique » Version 4

François Rioult, 03/02/2011 20:15

1 1 François Rioult
h1. Gnuplot
2
3
h2. Synopsis
4
5
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.
6
7
h2. Parameters
8
9
None.
10
11
h2. Inputs
12
13 2 François Rioult
2 input files : 
14 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 
15
<pre>set title "complexite de l'extraction des frequents"
16
set logscale
17
set style data lines
18
set xlabel 'support minimum'
19
set ylabel 'nombre de frequents'
20
set y2tics
21
set y2label 'temps extraction en s.'
22
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'
23
</pre>
24 2 François Rioult
* the second is the data to be plot.
25 1 François Rioult
26
h2. Outputs
27
28
1 output: the .PNG image representing the plot.
29
30
h2. Shell Code
31
32
<pre>
33
#!/bin/bash
34
35
# this shell uses gnuplot with the script as first input on the data
36
# on the second output
37
# the @file@ string in the gnuplot script is replaced by the data file.
38
39
script=$1; shift
40
data=`echo $1 | sed 's/\//\\\\\//g'`; shift
41
output=$1; shift
42
43
(
44
    echo "set terminal png" 
45
    echo "set output '$output'" 
46
    sed "s/@file@/$data/g" $script
47
) > $script.plot
48
49
gnuplot $script.plot
50
rm $script.plot
51
</pre>
52
53
h2. Example
54
55
This operator is used plotting the results in the stream [[Data mining complexity]].