0

How can I get a matplotlib x-axis date with the format Mon-%d-%Y? In other words, with the month spelled out either in full or with a three char abbreviation?

Rory Daulton
  • 21,934
  • 6
  • 42
  • 50
W. R. Wing
  • 69
  • 1
  • 4
  • 1
    What format is your data in? Can we see an example? – Jack Parkinson Jun 20 '17 at 20:47
  • 2
    Are you looking for the `%b` directive? See [here](https://docs.python.org/2/library/time.html#time.strftime), "locale's abbreviated month name". – user812786 Jun 20 '17 at 21:27
  • In addition to the correct formatting code per whrrgarbl, to apply it to the entire axis use `ax.xaxis.set_major_formatter` per the question answered here: [link](https://stackoverflow.com/questions/14946371/editing-the-date-formatting-of-x-axis-tick-labels-in-matplotlib) – Patrick O'Connor Jun 20 '17 at 22:53
  • Add the code showing the basic data set and the non-working plot. – Denise Skidmore Jun 21 '17 at 03:48

0 Answers0