Hello,

I am having trouble setting the formatting for date objects that are
displayed on the tick marks of one graph that I am making.  The following
example code reproduces the problem for me:

from datetime import date

import matplotlib.dates as mdate

import matplotlib.pyplot as plt

p1 = plt.subplot(211)

p1.yaxis.set_major_formatter(mdate.DateFormatter('%b %d', None))

plt.plot([date(2002, 3, 10)], [1])

The traceback that I am getting is as follows:
Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py",
line 798, in draw
    func(*args)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py",
line 1934, in draw
    a.draw(renderer)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py",
line 971, in draw
    tick_tups = [ t for t in self.iter_ticks()]
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py",
line 907, in iter_ticks
    majorLabels = [self.major.formatter(val, i) for i, val in
enumerate(majorLocs)]
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/dates.py",
line 335, in __call__
    dt = num2date(x, self.tz)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/dates.py",
line 289, in num2date
    if not cbook.iterable(x): return _from_ordinalf(x, tz)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/dates.py",
line 203, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1

Any idea what I could be doing wrong with my formatting here?  I am using
Matplotlib version 1.0.0.  Thanks very much,

Adrian
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to