Hi, i try to use the plot_date function and i have some problems, is
anybody can help me
My program :
First to show it's ok to run if i just used the only plot function
> from pylab import *
> import marshal
> import time
> import string
>
> lst_date=[]
> points=[]
> belos=[['2', '2', '2', '2', '2', '2', '2', '54', '125', '169', '224',
> '245', '245', '245', '325', '325', '325', '453', '486', '521', '521',
> '521', '8596', '9566', '9848', '10064'], [1148378715.6400001,
> 1148379045.312, 1148379057.7179999, 1148379069.375, 1148379331.921,
> 1148390222.3280001, 1148390265.2650001, 1148396382.562,
> 1148464116.609, 1148481671.6559999, 1148534908.2520001,
> 1148551483.8299999, 1148573370.8770001, 1148589279.517,
> 1148625453.8429999, 1148640384.5150001, 1148659451.25, 1148709552.921,
> 1148740419.375, 1148799935.5780001, 1148827804.0, 1148886086.109,
> 1148915795.984, 1148972914.8429999, 1149001049.671,
> 1149053926.7650001], ['2:349:7', '2:349:7', '2:349:7', '2:349:7',
> '2:349:7', '2:349:7', '2:349:7', '3:56:5', '3:56:5', '3:56:5', '3:56:5']]
>
> point=belos[0]
> dt_date=belos[1]
>
>
> for j in dt_date:
> date=time.ctime(j)
> lst_date.append(date)
>
> print lst_date
>
>
> for i in point:
> a=int(i)
> points.append(a)
>
> print belos
> print point
> print len(point)
> print len(lst_date)
> #plot (date, point, 'ro')
> #show()
>
> #plot_date(dt_date, points, '', xdate=True, ydate=False)
> plot(dt_date, points, '',)
> #savefig('secondfig.png')
> show()
The i try with the plot_date function and i got on error:
> Traceback (most recent call last):
> File "C:\Python24\uni_22\belos_stat.py", line 32, in -toplevel-
> plot_date(dt_date, points, '', xdate=True, ydate=False)
> File "C:\Python24\Lib\site-packages\matplotlib\pylab.py", line 2039,
> in plot_date
> ret = gca().plot_date(*args, **kwargs)
> File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2830,
> in plot_date
> self.autoscale_view()
> File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 815,
> in autoscale_view
> self.set_xlim(locator.autoscale())
> File "C:\Python24\Lib\site-packages\matplotlib\dates.py", line 537,
> in autoscale
> dmin, dmax = self.datalim_to_dt()
> File "C:\Python24\Lib\site-packages\matplotlib\dates.py", line 403,
> in datalim_to_dt
> return num2date(dmin, self.tz), num2date(dmax, self.tz)
> File "C:\Python24\Lib\site-packages\matplotlib\dates.py", line 205,
> in num2date
> if not iterable(x): return _from_ordinalf(x, tz)
> File "C:\Python24\Lib\site-packages\matplotlib\dates.py", line 154,
> in _from_ordinalf
> dt = datetime.datetime.fromordinal(ix)
> ValueError: year is out of range
i want the x axis show me the date on this format : Tue May 23 12:05:15
2006', 'Tue May 23 12:10:45 2006', 'Tue May 23 12:10:57 2006 etc...
Thx for answer
|