python - plotting datetime object in matplotlib -



python - plotting datetime object in matplotlib -

i have array of datetime objects following

dates = [datetime.datetime(1900, 1, 1, 10, 8, 14, 565000), datetime.datetime(1900, 1, 1, 10, 8, 35, 330000), datetime.datetime(1900, 1, 1, 10, 8, 43, 358000), datetime.datetime(1900, 1, 1, 10, 8, 52, 808000)]

i tried converting array matplotlib suitable objects using dates = plt.dates.date2num(dates)

then tried plot against values using ax1.plot_date(dates, datac)

but received errors follows:

exception in tkinter callback traceback (most recent phone call last): file "c:\python34\lib\tkinter\__init__.py", line 1487, in __call__ homecoming self.func(*args) file "c:\python34\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 278, in resize self.show() file "c:\python34\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 349, in draw figurecanvasagg.draw(self) file "c:\python34\lib\site-packages\matplotlib\backends\backend_agg.py", line 461, in draw self.figure.draw(self.renderer) file "c:\python34\lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper draw(artist, renderer, *args, **kwargs) file "c:\python34\lib\site-packages\matplotlib\figure.py", line 1079, in draw func(*args) file "c:\python34\lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper draw(artist, renderer, *args, **kwargs) file "c:\python34\lib\site-packages\matplotlib\axes\_base.py", line 2092, in draw a.draw(renderer) file "c:\python34\lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper draw(artist, renderer, *args, **kwargs) file "c:\python34\lib\site-packages\matplotlib\axis.py", line 1103, in draw ticks_to_draw = self._update_ticks(renderer) file "c:\python34\lib\site-packages\matplotlib\axis.py", line 957, in _update_ticks tick_tups = [t t in self.iter_ticks()] file "c:\python34\lib\site-packages\matplotlib\axis.py", line 957, in <listcomp> tick_tups = [t t in self.iter_ticks()] file "c:\python34\lib\site-packages\matplotlib\axis.py", line 905, in iter_ticks i, val in enumerate(majorlocs)] file "c:\python34\lib\site-packages\matplotlib\axis.py", line 905, in <listcomp> i, val in enumerate(majorlocs)] file "c:\python34\lib\site-packages\matplotlib\dates.py", line 580, in __call__ result = self._formatter(x, pos) file "c:\python34\lib\site-packages\matplotlib\dates.py", line 412, in __call__ homecoming self.strftime(dt, self.fmt) file "c:\python34\lib\site-packages\matplotlib\dates.py", line 450, in strftime s1 = time.strftime(fmt, (year,) + timetuple[1:]) valueerror: invalid format string

does have advice on how prepare this? in advance!

python datetime matplotlib

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -