Menu

No error message when plotting column that does not exist

Help
James
2017-05-15
2017-05-15
  • James

    James - 2017-05-15

    I am using Gnuplot G N U P L O T Version 5.1 patchlevel 0 last modified 2017-05-08 on OS X 10.11.2, and I get the following behavior which I do not understand. Given the following file 'data.dat' http://ge.tt/4Qejp6k2 , I execute

    p for [i=1:4] 'data.dat' u 1:(column(1+i)) w l

    Because there are only four columns in data.dat, this plot is out of range, but it gives me no error message, it just plots columns 2 to 4. Why? I would like to have an error message in order to find out when I am doing something wrong, and I seem to recall that I did get an error message with other Gnuplot versions.

    Thank you.

     
  • Ethan Merritt

    Ethan Merritt - 2017-05-15

    To find the number of columns in a file:

    stats 'data.dat'
    print STATS_columns
    
     
  • James

    James - 2017-05-15

    Thank you, but that does not answer my question.

     
    • Ethan Merritt

      Ethan Merritt - 2017-05-16

      An empty plot generated during an iteration is not considered an error.
      This is intentional. Consider a hypothetical script command:
      plot for [n=1:99] sprintf( "datafile_%d.dat", n)
      It would be really annoying if you lost plots 50-99 just because
      datafile_49.dat was missing or empty.

      The program does give a warning in some cases, but I agree it is not 100%
      consistent about the warning.

      This gives a warning:
      plot for [n=1:toobig] 'file' using 0:n
      This does not
      plot for [n=1:toobig] 'file' using 0:(column(n))

      I don't see any difference between current cvs and older versions back to
      5.0.2 in this regard.

      On Mon, May 15, 2017 at 2:28 PM, James james1979@users.sf.net wrote:

      Thank you, but that does not answer my question.


      No error message when plotting column that does not exist


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/gnuplot/discussion/5925/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.