Gnuplot does not handle "\" continuation character at end of comment lines correctly.
Tested on Ubuntu 20.10 with gnuplot 5.2 patchlevel 8
replot
^
"demo2.plot" line 8: no previous plot
...simple example below. Remove the trailing "\" in the comment line to make it work.
a = 0.9
f(x) = a * sin(x)
g(x) = a * cos(x)
#plot f(x) title 'sin(x)' with lines linestyle 1, \
plot f(x) title 'sin(x)' with lines linestyle 1, \
g(x) notitle with lines linestyle 2
replot
pause -1
Your expectation of what "correct behaviour" would be in this case is unjustified.
https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_03
...see rule 10, that was essentially my expectation - "If the current character is a '#', it and all subsequent characters up to, but excluding, the next
<newline>shall be discarded as a comment. The<newline>that ends the line is not considered part of the comment."I had assumed this functionality since you are using shell-style comments. Else please point me to something that would justify the "correct behaviour" so I can understand where I went wrong and don't make wrong assumptions. Thanks!
Last edit: internationils 2021-05-05
Here is the section from gnuplot documentation:
Last edit: Ethan Merritt 2021-05-05