I just stumbled across the following:
According to the gnuplot manual a plot element may contain a definition.
Syntax:
plot {<ranges>} <plot-element> {, <plot-element>, <plot-element>}
Each plot element consists of a definition, a function, or a data source
together with optional properties or modifiers:
plot-element:
{<iteration>}
<definition> | {sampling-range} <function> | <data source>
| keyentry
{axes <axes>} {<title-spec>}
{with <style>}
Check the following example:
For the first graph
y=x+1is plotted becausea=1was defined earlier. As expected.For the second graph and the first plot command it should be the same but
y=2*x+1is plotted instead (twice).In the third graph when
a=1is explicitely specified it is plotted as expected.
Why is gnuplot ignoring a=1 for the second graph?
Have I misunderstood something?
Code:
### definitions in plot command
reset session
a = 1
b = 1
f(x) = a*x + b
set yrange[-40:40]
set multiplot layout 1,3
plot f(x)
plot f(x), a=2 f(x), a=3 f(x)
plot a=1 f(x), a=2 f(x), a=3 f(x)
unset multiplot
### end of code
Result:
