Beginner's problem

  • tomih

    tomih - 2009-08-29

    Hi, as an absolute beginner with gnuplot I got stuck with a very basic problem: I'm trying to plot a file with timestamps and two variables. The file is a mysql export and looks like this:

    2009-08 17-21:18:02     1140    0
    2009-08 17-21:19:01     1342    1213
    2009-08 17-21:20:01     1380    2009
    2009-08 17-21:21:01     1560    2511

    I try to plot it as follows:
    set xdata time
    set timefmt "%Y-%m-%d %H-%M-%S"
    plot "testdata" using 1:2 title 'A' with lines, "testdata" using 1:3 title 'B' with lines

    And I get an error:
    Warning: empty x range [3.03858e+08:3.03858e+08], adjusting to [3.00819e+08:3.06897e+08]

    What is wrong and what would be the right way to plot it? I can change the format of the timestamp column, if needed. Thanks already!



    • Edoardo Pasca

      Edoardo Pasca - 2009-08-30

      At least your time format is wrong according to the file excerpt:
      2009-08 17-21:19:01
      set timefmt "%Y-%m-%d %H-%M-%S"

      It should be
      set timefmt "%Y-%m %d-%H:%M:%S"

      but I don't know if it works because of the space.

    • Hans-Bernhard Broeker

      Besides the mismatch between data and timefmt setting, you would have to change your 'using' arguments.  Time data with a blank in it counts as two columns, so your y data are in columns 3 and 4, not 2 and 3.

      • tomih

        tomih - 2009-08-30

        Thanks guys! Such a stupid mistake and such a time that I spent looking for it! I also tried changing the column numbers but that didn't change the situation.

        Stupid me! Thanks!



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks