SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Richard R. <ric...@pa...> - 2006年07月28日 21:19:24
I upgraded to matplotlib-0.87.4 Now I receive an error like the following every time I try to use matplotlib.dates. The following error messages were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.py
Any Idea on how I can get dates working again?
(I am running the 2.6.17.6 kernel on a 64-bit linux system)
Example:
matplotlib-0.87.4/examples]$ python date_demo1.py
Traceback (most recent call last):
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line 284, in expose_event
 self._render_figure(self._pixmap, w, h)
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", line 73, in _render_figure
 FigureCanvasAgg.draw(self)
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 391, in draw
 self.figure.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line 532, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 1045, in draw
 a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axis.py", line 548, in draw
 majorLabels = [self.major.formatter(val, i) for i, val in enumerate(majorLocs)]
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 247, in __call__
 dt = num2date(x, self.tz)
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 205, in num2date
 if not iterable(x): return _from_ordinalf(x, tz)
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 156, in _from_ordinalf
 hour, remainder = divmod(24*remainder, 1)
ValueError: need more than 0 values to unpack
Traceback (most recent call last):
Richard
From: PGM <pgm...@gm...> - 2006年07月29日 17:28:03
On Friday 28 July 2006 17:19, Richard Ruth wrote:
> I upgraded to matplotlib-0.87.4 Now I receive an error like the following
> every time I try to use matplotlib.dates. The following error messages
> were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.py
>
> Any Idea on how I can get dates working again?
> (I am running the 2.6.17.6 kernel on a 64-bit linux system)
Richard,
in matplotlib/dates.py, change line 155 from
remainder = x - ix
to
remainder = float(x) - ix
The problem is that matplotlib uses numpy arrays for the xaxis. As you have a 
64b system, the arrays are in float64scalars, that divmod doesn't know how to 
process (unless you have a very recent of numpy). The trick above forces a 
downcasting of float64scalar to float32scalar, divmod can now work.
From: John H. <jdh...@ac...> - 2006年07月29日 18:11:46
>>>>> "PGM" == PGM <pgm...@gm...> writes:
 PGM> Richard, in matplotlib/dates.py, change line 155 from
 PGM> remainder = x - ix to remainder = float(x) - ix
Thanks for th tip -- I'll commit this to svn.
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /