How can I make DateListPlot show the iso week number? I would like to make a Date plot so that for each dot it will show the iso week date in the x-axis .


1 Answer 1


I don't see why this shouldn't work:

DateListPlot[FinancialData["IBM", "Jan. 1, 2015"], DateTicksFormat -> {"Week"}]

But it doesn't. There is only one tick mark.

Mathematica graphics

It appears that DateString was updated at some point (I believe in 10.2, the documentation doesn't mention) to support many different formats, including ISO weeks. DateTicksFormat was not updated, at least the new formats are not mentioned in its documentation page.

It appears that DateTicksFormat might influence not only the content of tick labels (i.e. the labels themselves), but also the frequency of ticks. Something goes wrong when using a new format not mentioned in the DateTicksFormat documentation.

As a workaround I specified the ticks manually:

DateListPlot[FinancialData["IBM", "Jan. 1, 2015"], 
 DateTicksFormat -> {"Week"},
 FrameTicks -> {{Automatic, 
    Automatic}, {DateRange[DateObject[{2015, 1, 1}], Today, 
     Quantity[2, "Weeks"]], Automatic}}]

To enter "2 weeks" and "January 1st 2015", I used Control-Enter with natural language input.

Mathematica graphics

  • $\begingroup$ I'm running 10.1 and I get "Week" for every x-axis tick using your code i.imgur.com/ODnQJ2A.png $\endgroup$ Oct 21, 2015 at 15:16
  • $\begingroup$ @MartinJohnHadley That's because this is new in 10.2 I think, see the link posted by belisarius. The documentation doesn't say when the update happened. $\endgroup$
    – Szabolcs
    Oct 21, 2015 at 16:03
  • $\begingroup$ If it worked in 10.1, it went kaput in 10.2; I get the same thing as Szabolcs. $\endgroup$ Oct 21, 2015 at 16:10
  • $\begingroup$ Great, thanks. I need to update sorely but keep putting it off $\endgroup$ Oct 21, 2015 at 16:11
  • 2
    $\begingroup$ @MartinJohnHadley Personally I hadn't noticed any big problems (regressions) with 10.3 yet ... This performance regression is the only one I know of. But then I only use a very limited subset of Mathematica. $\endgroup$
    – Szabolcs
    Oct 21, 2015 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.