Hi,
I am trying to figure out how to include a conditional plotting
statement in my shell-script, but am failing spectacularly so far.
What I want to do is to include a file to be plotted if it exists, and
if not - plot the ones that is.
Trying to follow the manual:
http://gnuplot.sourceforge.net/docs_4.2/node96.html
..... and including an if-statement in my script:
..
..
..
gnuplot << EOF
set terminal pdf enhanced color fsize 50 size $width,$height # Output
settings
set output "norway_detailed.pdf" # Output
filename
set noxtics # Do not plot
any tics
set noytics
set angles degrees # Define degrees to be the
angles
set nogrid # Do not plot a grid
set noborder # Do not plot a border
set nokey # Do not plot a legend
set pointsize 1 # Set the sice of the
pencil
set xrange [$low_x:$high_x] # Define the region to be
plotted
set yrange [$low_y:$high_y]
set style fill solid 0.25 border -1 # Red 20% red fillcolour
set style line 2 lt 1 lw 20 pt 6 # Linestyle 2: black/think
line
if ($track_exist==1) plot "$sourcemapoverview" with filledcurves lt 1,\
"$sourcemapdetailedfeatures" using 1:2:3 with
labels lt 1,\
"track.txt" with dots,\
"geotagged_photos_numbered.dat" using 2:3:1
with labels lt 6;
else plot "$sourcemapoverview" with filledcurves lt 1,\
"$sourcemapdetailedfeatures" using 1:2:3 with
labels lt 1,\
"geotagged_photos_numbered.dat" using 2:3:1
with labels lt 6
unset size # Unset some values to be ready for the
next plot
unset style line
unset style fill
EOF
..
..
..
(Full script at
http://www.ia-stud.hiof.no/~kjellare/misc/20080910_plotmap.sh)
gives me this:
-----
gnuplot> else plot
"/Users/refsvik/Do***ents/master/programmering/plot_test/norway_shapefil
e2.txt" with filledcurves lt 1,
"/Users/refsvik/Do***ents/master/programmering/plot_test/norway_detaile
d_features.dat" using 1:2:3 with labels lt 1,
"geotagged_photos_numbered.dat" using 2:3:1 with labels lt 6
^
line 0: else without if
node172:Desktop refsvik$
-----
I obviously got the if-statement wrong. I would love it if anyone would
point out my flaw, and post it here.
Sincerely,
Kjell Are Refsvik


|