Here is one part of my script:
if (PNG == 1) {
set terminal png size 1024,768 font "Arial,11"
SAVE_AS = FILENAME.'.png'
print " - Create file: ".SAVE_AS
set output SAVE_AS
plot DATA_FILE using ($1/3600.0):(column('POW-FP+D')) with lines title 'POW-FP+D' linecolor rgb "red" axis x1y1,
DATA_FILE using ($1/3600.0):(column('PR-Core')) with lines title 'PR-Core' linecolor rgb "blue" axis x1y2
}
if (SVG == 1) {
set term svg size 600,400 dynamic font 'Arial,11'
SAVE_AS = FILENAME.'.svg'
print " - Create file: ".SAVE_AS
set output SAVE_AS
plot DATA_FILE using ($1/3600.0):(column('POW-FP+D')) with lines title 'POW-FP+D' linecolor rgb "red" axis x1y1,
DATA_FILE using ($1/3600.0):(column('PR-Core')) with lines title 'PR-Core' linecolor rgb "blue" axis x1y2
}
As you can see the plot DATA_FILE … occures two times in my code, once in the PNG-part and once in the SVG-part. Is it possible to put the code in some kind of a variable and then refere to this variable. Here some pseudo-code:
a = DATA_FILE using ($1/3600.0):(column('POW-FP+D')) with lines title 'POW-FP+D' linecolor rgb "red" axis x1y1,
DATA_FILE using ($1/3600.0):(column('PR-Core')) with lines title 'PR-Core' linecolor rgb "blue" axis x1y2
if (PNG == 1) {
...
plot a
}
if (SVG == 1) {
...
plot a
}