|
From: Ethan M. <eam...@gm...> - 2026-03-30 23:23:29
|
On Mon, Mar 30, 2026 at 12:22 AM Bjorn Buckwalter <
bjo...@gm...> wrote:
> Thanks Ethan for digging to the bottom of this and for the workaround! (I
> guess that the other workaround is simply to not use `\` and have very long
> lines, at the expense of readability, of course.)
>
> Note that I still see the second problem that I mentioned at the end of an
> earlier email. I repeat it here. This is the message I get if I include
> your "junk" code prior to my script. As expected the data files are not
> found, but the strange thing is the last message:
>
> ```
> reference a string of length 6144
> garbage
> "$plot_polar" line 13: warning: Cannot find or open file "world_110m.txt"
> "$plot_polar" line 13: warning: Cannot find or open file "data/ReportA.txt"
> "$plot_polar" line 13: warning: Cannot find or open file "data/ReportA.txt"
> "$plot_polar" line 13: undefined variable: orbit
> ```
>
> I have had trouble where this last message/error pops up sometimes and I
> haven't been able to nail down the exact circumstances. I believe in this
> case that it refers to `title orbit`. If I change that to `notitle` it
> disappears. And changing from `notitle` to `title orbit` in the preceding
> line does not trigger the message. This seems also somehow related to the
> length of the command.
>
> Many thanks,
> Bjorn
>
You have a talent for finding bugs.
I have filed this one on the bug tracker
https://sourceforge.net/p/gnuplot/bugs/2865/
It contains a 1-line example that triggers the bug.
I think you can get this error message only if (a) the previous plot did
not find any points to plot
and (b) the current plot gives no explicit title.
You can avoid this error message in your particular script by adding a
title to the line that plots 0
for [orbit in orbits] \
'data/Report'.orbit.'.txt' using (lon($7)):($3 == 2030 ?
filter_lat($6) : NaN) \
lc rgb next_color(n) title orbit, \
0 title "0", \
^^^^^^^^^^^^^^^
Why? The plot that found no points had already stored a function to
generate what
would have been the title. But then it never plotted anything and neither
evaluated nor
cleared that function afterwards. So then if the _next_ plot doesn't
provide a title of its
own it inherits the function to generate one. In this case that
generated title,
which would
have been wrong in any case, references a variable that is no longer in
scope.
The bug will be easy to fix in the code, but the work-around is also easy
-- give the following plot a title.
Ethan
|