Menu

#2038 save breaks when plot line is too long

None
closed
nobody
save (1)
2023-01-31
2018-04-15
No

Using Version 5.2 patchlevel 2 on macOS 10.13.3.

When using the following plot command (which works fine)

plot "< perl -n -a -e '$df=$F[0]-$F[1]-30; $h-=292*$df; print \"$F[2] $h $df\n\";' wwv-5MHz-GPS-30Hz.txt" us 1:2 tit 'Height change', "" us 1:3 ax x1y2 tit 'Doppler shift'

then saving with

save "wwv.gnp"

the file contains the following two lines (shown here as two code segments for clarity)

## Last datafile plotted: "< perl -n -a -e '$df=$F[0]-$F[1]-30; $h-=292*$df/1000; print "$F[2] $h $df
";' wwv-5MHz-GPS-30Hz.txt"

the second of which is a syntax error, of course, when loaded back in:

gnuplot> load "wwv.gnp"
gnuplot> ";' wwv-5MHz-GPS-30Hz.txt"
         ^
         "wwv.gnp", line 174: invalid command

Discussion

  • Ethan Merritt

    Ethan Merritt - 2018-04-16

    I suspect it is not the length of the line but a failure to preserve embedded quotes and newline.

    That said, I can't decipher what is being produced by that perl command without having the data file inself to test. Can you upload the file wwv-5MHz-GPS-30Hz.txt?

     
  • Elwood Downey

    Elwood Downey - 2018-04-16

    I could ... but it's huge. Probably all you really want to know is its format which is demonstrated by this one typical line:

    1000.65 970.728 1523770647.32
    

    I tend to agree with your overall diagnosis. I've used very long plot commands in the past without seeing this issue, so it is probably somehing about the quoting. Note that the plot command does work as intended so no need to delve into it much, it's just the save file that gets messed up. If I simply comment out the extraneous line following the "Last datafile" line then all is well.

    Just waned to get this on the list, nothing urgent.

     
  • Ethan Merritt

    Ethan Merritt - 2018-04-18

    I can't wrap my brain around all the nested quotes and two different programs, gnuplot and perl, having to deal with the result. So I don't know how it "should" be written. But adding another backslash in front of the newline seems to make it work.

    plot "< perl -n -a -e '$df=$F[0]-$F[1]-30; $h-=292*$df; print \"$F[2] $h $df\\n\";' wwv-5MHz-GPS-30Hz.txt" us 1:2 tit 'Height change', "" us 1:3 ax x1y2 tit 'Doppler shift'>
    
     

    Last edit: Ethan Merritt 2018-04-18
  • Ethan Merritt

    Ethan Merritt - 2023-01-31
    • status: open --> closed
    • Group: -->
    • Priority: -->
     

Log in to post a comment.