Menu

#811 plot for notation generates unreadable graphics files

closed-invalid
nobody
2D plot (258)
5
2015-03-23
2009-10-31
Anonymous
No

I have found a problem with gnuplot 4.5 generating unreadable graphics files (.png, .jpeg, and .gif) when the iterative plot for notation is used. This problem has been observed on both Ubuntu 9.04 and RedHat Enterprise Linux 5.3 systems, with builds generated on each system separately. The source code is latest as of Oct. 29, 2009.

The attached archive shows this. The archive has two subfolders, Iterative and NonIterative. Each folder contains a datafile, a script file and a generated jpeg
file generated by the command

gnuplot-4.5 <scriptfile>

In the Iterative folder the data file contains a single run of data. The script that processes it uses the "plot for [i in datasetnames]" notation (gnuplot 4.5) which Thomas Sezfick showed me in a reply on the mailing list. The script produces a non-readable jpeg file.

In the NonIterative folder, the data is the same but with double line-feeds manually inserted between the series. The script uses the hardcoded series names without the "plot for" and is gnuplot 4.0 compatible. The script produces a readable jpeg file.

The same problems are observed with .gif and .png plots.

This leads me to the conclusion that the bug is in the iterative (plot for) mechanism itself, perhaps with an interaction with the terminal code. Using the default X11 terminal good plots are obtained either way.

Discussion

  • Nobody/Anonymous

    sample data, scripts and generated files

     
  • Ethan Merritt

    Ethan Merritt - 2009-10-31

    There are a number of problems with your script.

    (1) When I run it here, the initial tabular output fails with the messages:
    gnuplot> load 'getcallstats1.gp'
    Warning: empty y range [0:0], adjusting to [-1:1]

    # Curve 0 of 1, 115 points
    # Curve title: "'callstats1.txt' us 1:(stringcolumn(2) eq laststring ? 0 : (laststring = stringcolumn(2) , datasetnames = datasetnames . " " . laststring, 0))"
    # x y type
    "01/01" 0 i
    "10/01" 0 i
    [...snip...]
    "10/28" 0 i
    "10/29" 0 i
    "01/01" 0 u

    Abort

    (2) Your "corrupt" jpeg file is not a jpeg file at all. It is simply the text output shown above. Because you didn't specify a separate output file name in the 'set table' command, it was sent to the current output stream, which you had previously set to 'getcallstats1.jpg'. The fix for this is to say "set table 'table.out'"

    I can't get any useful output from this script at all regardless of the terminal type. I've tried editing the script to correct some of the errors, but I still don't end up with a useful plot. Could you please reduce this to a simpler test case?

    (3) Your non-iterative script works better because it doesn't send tabular text output to the *.jpg file :-)

    One problem here is that you didn't say "with labels" in the plot command, so it is trying to plot the file names as y coordinates.

    It may also be true that the table-generating code doesn't handle iteration correctly. But a simpler test case would be nice.

     
  • Steve Cohen

    Steve Cohen - 2009-10-31

    The problem is that I was simply following a script idea from Thomas Sefzick (https://sourceforge.net/mailarchive/message.php?msg_name=26114415.post%40talk.nabble.com) without fully understanding it. I had never used the "set table" command and had no idea what it did or why it was in Thomas' example. By putting the set outfile before the "dummy plot generation", I caused the "set table" output to go there instead of nowhere. The set output should have come after the first plot - in which case all is well.

    As for my remark about useful output being generated to the default terminal, this was due to the fact that the "set output" line wasn't needed or present at all in that version of the script.

    Anyway, thanks for looking into this and helping me get unconfused.

    If not already closed, please close this issue.

     
  • Ethan Merritt

    Ethan Merritt - 2009-10-31
    • status: open --> closed-invalid
     

Log in to post a comment.