#514 recognize %W in the input time column


%W is a week number within a year. Gnuplot cannot recognize it in the timefmt. I have a lot of data sets with a time column containing a year and a week number.

set xdata time # input for X axis contains time
set timefmt "%Y-%W" # input time format <<< %W NOT RECOGNIZED BY GNUPLOT
set format x "%Y-%W" # output format on axis X
plot '-' using 1:2 title "rawhide" with filledcurve x1
2009-33 8
2009-34 11
2009-35 9
2009-36 33

Gnuplot 4.4.2 output:
2009-33 8
-:1: line 1: warning: Bad time format in string
2009-34 11
-:2: line 2: warning: Bad time format in string
2009-35 9
-:3: line 3: warning: Bad time format in string
2009-36 33
-:4: line 4: warning: Bad time format in string

Please consider the proposed patch which fixes this problem by adding %W to the default gstrptime implementation.

Run tested on my data sets.


  • Anonymous - 2010-12-28

    Proposed patch

  • Anonymous - 2010-12-28
    • summary: recogniz %W in the input time column --> recognize %W in the input time column
  • Ethan Merritt

    Ethan Merritt - 2011-02-13

    The man page for strftime() documents the %W format as
    %W The week number of the current year as a decimal number,
    range 00 to 53, starting with the first Monday as the
    first day of week 01.
    Similarly, the man page for strptime() says
    %W The week number with Monday the first day of the week (0-53).
    The first Monday of January is the first day of week 1.

    Your implementation does not appear consistent with these definitions, since it assumes that week 0 contains 7 days. Was your data set created in accordance with a different definition?

  • Anonymous - 2011-02-17

    Yes, the data set used the same (incorrect) assumption as the patch. Thank you for pointing this out. I'm attaching improved version, which handles the variable length of week 0.

    Can you look at this one, please?

  • Anonymous - 2011-02-17

    Proposed patch v2

  • Anonymous - 2011-02-17

    A test program comparing jan_first_wday of gnuplot and glibc

  • Nobody/Anonymous

    M9bxEa <a href="http://mthdpaqrgzev.com/">mthdpaqrgzev</a>, [url=http://beuauejiayfy.com/]beuauejiayfy[/url], [link=http://cxmhnifriusq.com/]cxmhnifriusq[/link], http://bdsbkkdpfqby.com/

  • Nobody/Anonymous

    bLwUfJ <a href="http://jgerlzxfmnko.com/">jgerlzxfmnko</a>, [url=http://yfflcxyxtjqh.com/]yfflcxyxtjqh[/url], [link=http://pptrvpmwajng.com/]pptrvpmwajng[/link], http://jmbyqmvibhph.com/


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks