On Wed, Mar 14, 2012 at 2:16 PM, Aman Thakral <aman.thak...@gmail.com>wrote:
> I recently upgrade to Python 2.7 (I used EPD Free for the install which
> comes with matplotlib 1.1.0) and I'm getting the following error when I try
> to plot dates. I've tried a few different backends, but they all seem to
> give the same error. I had no issues using Python 2.6 up to now. I think
> this may have to do with the new requirement in Python 2.7 that if you
> passed a float to a function that was defined as an int, it now raises a
> TypeError (instead of a DeprecationWarning).
>
> Traceback (most recent call last):
> File "C:\Python27\lib\site-packages\matplotlib\backends\backend_wx.py",
> line 1289, in _onLeftButtonDown
> FigureCanvasBase.button_press_event(self, x, y, 1, guiEvent=evt)
> File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line
> 1632, in button_press_event
> self.callbacks.process(s, mouseevent)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 256, in
> process
> proxy(*args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 189, in
> __call__
> return mtd(*args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line
> 1522, in pick
> self.figure.pick(mouseevent)
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 332, in
> pick
> a.pick(mouseevent)
> File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 3038, in
> pick
> martist.Artist.pick(self,args[0])
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 332, in
> pick
> a.pick(mouseevent)
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 321, in
> pick
> self.figure.canvas.pick_event(mouseevent, self, **prop)
> File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line
> 1598, in pick_event
> self.callbacks.process(s, event)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 256, in
> process
> proxy(*args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 189, in
> __call__
> return mtd(*args, **kwargs)
> File "C:\src\QC_DUAL\src\QC_DUAL\databrowser.py", line 284, in onpick
> self.fig.canvas.draw()
> File
> "C:\Python27\lib\site-packages\matplotlib\backends\backend_wxagg.py", line
> 59, in draw
> FigureCanvasAgg.draw(self)
> File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 401, in draw
> self.figure.draw(self.renderer)
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 884, in
> draw
> func(*args)
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 1983, in
> draw
> a.draw(renderer)
> File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1036, in
> draw
> ticks_to_draw = self._update_ticks(renderer)
> File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 926, in
> _update_ticks
> tick_tups = [ t for t in self.iter_ticks()]
> File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 873, in
> iter_ticks
> majorLocs = self.major.locator()
> File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 594, in
> __call__
> dates = self.rule.between(dmin, dmax, True)
> File "C:\Python27\lib\site-packages\dateutil\rrule.py", line 207, in
> between
> for i in gen:
> File "C:\Python27\lib\site-packages\dateutil\rrule.py", line 451, in
> _iter
> dayset, start, end = getdayset(year, month, day)
> File "C:\Python27\lib\site-packages\dateutil\rrule.py", line 797, in
> ddayset
> i = datetime.date(year, month, day).toordinal()-self.yearordinal
> TypeError: integer argument expected, got float
>
Ok, so I managed to track this down. Apparently I was using a float
instead of an int in the interval argument of the HourLocator. I think
casting to the interval argument to int in the dates.HourLocator class
would be a good idea so users not familiar with the nuance won't have to
deal with this headache.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users