date2num/num2date and ordinal date

I did understand that in your first post, but I was focusing more on
your comments about a better date class than this specific bug, but I
see how the a better class would solve this bug too. But we can work
around this -- I committed some changes to the branch and trunk which
checks to see if the datalim have been updated on the call to xaxis
date and if not it will choose a valid default date range for the date
and view lim, but leave the "ignore" setting in place so it won't
affect the autoscaling when you actually do add data. Hit it with
your standard battery of tests and let me know how it works.

Michael, in the process of adding support for this, I added a check to
the Axes.update_datalim to ignore empty lists

    def update_datalim(self, xys):
        if len(xys): return

but when I ran backend driver, I found a bug on where
a non-iterable was being passed in for xys. I added a debug print
statement to update_datalim to print type(xys), and here is what I
got, along with the traceback

johnh@...539...:svn> python ~/mpl/examples/pylab_examples/
<type 'list'>
<type 'list'>
<type 'list'>
<type 'list'>
<type 'tuple'>
<type 'list'>
<type 'numpy.ndarray'>
<class 'matplotlib.transforms.Bbox'>
Traceback (most recent call last):
  File "/home/titan/johnh/mpl/examples/pylab_examples/",
line 83, in ?
    CB = colorbar(CS, shrink=0.8, extend='both')
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 1179, in colorbar
    ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 965, in colorbar
    cb = cbar.Colorbar(cax, mappable, **kw)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 591, in __init__
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 612, in add_lines
    ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 329, in add_lines
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 1242, in add_collection
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/",
line 1313, in update_datalim
    if not len(xys): return
TypeError: len() of unsized object

So the collection.get_datalim is returning a transformed bbox and
passing this off to update_datalim. This is easy to work around by
adding an iterable(xys) check, which I did on the branch and the
trunk, but to be sure I am not masking a bug, I wanted to make sure
that this is what should be happening here. I would think we would
call update_datalim_bounds for a bbox....




On Wed, Jun 4, 2008 at 12:01 PM, Ted Drain <ted.drain@...179...> wrote:

Sorry - I don't think I was very clear in my email. Try this:

import pylab as p
p.plot( [] ()