|
From: Philipp K. J. <ph...@ja...> - 2026-03-29 12:23:54
|
On Sun, 29 Mar 2026 11:49:01 +0200 Bjorn Buckwalter <bjo...@gm...> wrote: > Thanks Jesper and Philpp. Jespers suggestion with variables can > likely help – I will try it! It's not so easy for me to reproduce your problem, because I don't have access to the data files, etc. The cmd does not seem overly long. I still suspect that there is a problem with one of the CRs not being properly escaped - such as having a blank after a backslash, but before the actual CR. The error msg in your original email points to that, too. I did not dig into the code to see whether there is an actual limit to the length of the cmd line. Ethan would know. Do you enter the cmd interactively, or do you have it in a file, which you load? > > FYI here is an example plot command that fails: > > ``` > plot \ > 'world_110m.txt' using (lon($1)):(filter_lat($2)) with lines > linecolor "gray" notitle , \ > lat(0) with lines black dashtype 2 title "Equator" , \ > lat(66.6) with lines black dashtype 5 title "Arctic/Antarctic > circle", \ lat(-66.6) with lines black dashtype 5 notitle , \ > for [orbit in orbits] \ > 'data/Report'.orbit.'.txt' using (lon($7)):(filter_lat($6)) \ > with lines linecolor rgb next_color_t(n, 'cc') notitle, \ > for [orbit in orbits] \ > 'data/Report'.orbit.'.txt' using (lon($7)):($3 == 2030 ? > filter_lat($6) : NaN) \ > with lines linecolor rgb next_color(n) title orbit, \ > lat(lat1) black notitle # edge of plot > ``` > > There is A LOT going on there with various custom functions, etc. I > tried to make a minimal and “dependency-free” example but failed to > reproduce the behavior. I could maybe try harder. > > Here is in any case the error from gnuplot. The command has been > concatenated at all baskslashes except the last: > > ``` > plot 'world_110m.txt' using (lon($1)):(filter_lat($2)) with > lines linecolor "gray" notitle , lat(0) with lines black dashtype > 2 title "Equator" , lat(66.6) with lines black dashtype 5 title > "Arctic/Antarctic circle", lat(-66.6) with lines black dashtype 5 > notitle , for [orbit in orbits] 'data/Report'.orbit.'.txt' > using (lon($7)):(filter_lat($6)) with lines linecolor rgb > next_color_t(n, 'cc') notitle, for [orbit in orbits] > 'data/Report'.orbit.'.txt' using (lon($7)):($3 == 2030 ? > filter_lat($6) : NaN) with lines linecolor rgb next_color(n) > title orbit, \ lat(lat1) black notitle # edge of plot > > > > > > > > > ^ > "$plot_polar" line 15: invalid character \ > ``` > > There is nothing wrong with the backslash (no trailing spaces, etc.). > > If I change it as so (just shortening style definitions) it works: > > ``` > set style data lines > plot \ > 'world_110m.txt' using (lon($1)):(filter_lat($2)) lc "gray" > notitle , \ lat(0) black dt 2 title "Equator" , \ > lat(66.6) black dt 5 title "Arctic/Antarctic circle", \ > lat(-66.6) black dt 5 notitle , \ > for [orbit in orbits] \ > 'data/Report'.orbit.'.txt' using (lon($7)):(filter_lat($6)) \ > lc rgb next_color_t(n, 'cc') notitle, \ > for [orbit in orbits] \ > 'data/Report'.orbit.'.txt' using (lon($7)):($3 == 2030 ? > filter_lat($6) : NaN) \ > lc rgb next_color(n) title orbit, \ > lat(lat1) black notitle # edge of plot > ``` > > All I did was remove `with lines` (using `set style data lines` > instead and replace `linecolor` and `dashtype` with `lc` and `dt`, > respectively. This is why I say it seems to be somehow related to the > length/number of characters of a command. > > Thanks, > Bjorn > > > On Sun, Mar 29, 2026 at 5:28 AM Philipp K. Janert <ph...@ja...> > wrote: > > > On Sat, 28 Mar 2026 22:13:40 +0100 > > Bjorn Buckwalter <bjo...@gm...> wrote: > > > > > HI all, > > > > How long (in characters) are the command lines that > > you are using? Mine frequently run long, and it has > > never been a problem. > > > > Is it possible that you have problems with embedded > > newlines, or that something goes awry if your command > > line runs into a new line in your terminal? > > > > Best, > > > > Ph. > > > > > > > > I rather often run into a problem of my plot commands being too > > > long, typically resulting in a not-very-helpful error message > > > such as: > > > > > > "$plot_polar" line 21: invalid character \ > > > > > > It took a lot of head scratching to realize the root of the > > > problem. I assume there are strong reasons for both the > > > limitation on command length and the poor error message. > > > > > > I cannot be the only one running into this problem. The situation > > > being what it is, what are the rest of you doing to manage when > > > you run up against this limit? Replacing `linecolor` with `lc`, > > > etc, will only get me so far and at the expense of readability. > > > > > > Many thanks, > > > Bjorn > > > > > > _______________________________________________ > > > gnuplot-info mailing list > > > gnu...@li... > > > Membership management via: > > > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > > > > > > > -- > > > > Philipp K. Janert > > www.janert.me > > > > > > _______________________________________________ > > gnuplot-info mailing list > > gnu...@li... > > Membership management via: > > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- Philipp K. Janert www.janert.me |