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