ich hab ein Problem seit dem ich auf python2.6 gewechselt habe. Ich kann keine barplots mehr erstellen, sobald irgendwie Zeiten mit ins Spiel kommen.
Das ist jetzt einfach nur ein kurzes Beispiel.
Code: Alles auswählen
import matplotlib.pyplot as plt
from datetime import datetime
x = [datetime(2009, 7, 27, 0, 0), datetime(2009, 7, 28, 0, 0), datetime(2009, 7, 29, 0, 0), datetime(2009, 7, 30, 0, 0), datetime(2009, 7, 31, 0, 0), datetime(2009, 8, 1, 0, 0), datetime(2009, 8, 2, 0, 0)]
y = [38.29, 44.11,44.84,36.83, 39.82, 36.88, 17.86]
plt.bar(x, y)
plt.show()
Wobei die ersten beiden Meldungen ja nur Warnungen sind, die bekomme ich jetzt ständig, vielleicht zu alte matplotlib version? Ich benutze 0.91.2/usr/lib64/python2.6/site-packages/matplotlib/__init__.py:62: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5, os, re, shutil, sys, warnings
/usr/lib64/python2.6/site-packages/matplotlib/font_manager.py:37: DeprecationWarning: the sets module is deprecated
from sets import Set
Traceback (most recent call last):
File "/home/dejungma/.eclipse/org.eclipse.platform_3.4.0_272132067/configuration/eclipse/plugins/org.python.pydev.debug_1.4.7.2843/pysrc/pydevd.py", line 881, in <module>
debugger.run(setup['file'], None, None)
File "/home/dejungma/.eclipse/org.eclipse.platform_3.4.0_272132067/configuration/eclipse/plugins/org.python.pydev.debug_1.4.7.2843/pysrc/pydevd.py", line 710, in run
execfile(file, globals, locals) #execute the script
File "/home/dejungma/stuff/workspace/diagramm/src/line.py", line 22, in <module>
plt.bar(zeiten, kwatth)
File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 1402, in bar
ret = gca().bar(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 3294, in bar
self.add_patch(r)
File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1146, in add_patch
self._update_patch_limits(p)
File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1153, in _update_patch_limits
p.get_transform(), p.get_verts())
File "/usr/lib64/python2.6/site-packages/matplotlib/patches.py", line 362, in get_verts
right = self.convert_xunits(x + self.width)
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'float'
Danke schon mal.