Gnuplot » Historique » Version 1
François Rioult, 03/02/2011 20:06
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 input files : the first is the @GNUplot@ script, the second is the data to be plot. |
||
14 | |||
15 | h2. Outputs |
||
16 | |||
17 | 1 output: the .PNG image representing the plot. |
||
18 | |||
19 | h2. Shell Code |
||
20 | |||
21 | <pre> |
||
22 | #!/bin/bash |
||
23 | |||
24 | # this shell uses gnuplot with the script as first input on the data |
||
25 | # on the second output |
||
26 | # the @file@ string in the gnuplot script is replaced by the data file. |
||
27 | |||
28 | script=$1; shift |
||
29 | data=`echo $1 | sed 's/\//\\\\\//g'`; shift |
||
30 | output=$1; shift |
||
31 | |||
32 | ( |
||
33 | echo "set terminal png" |
||
34 | echo "set output '$output'" |
||
35 | sed "s/@file@/$data/g" $script |
||
36 | ) > $script.plot |
||
37 | |||
38 | gnuplot $script.plot |
||
39 | rm $script.plot |
||
40 | </pre> |
||
41 | |||
42 | h2. Example |
||
43 | |||
44 | This operator is used plotting the results in the stream [[Data mining complexity]]. |