|
From: Paul H. <pmh...@gm...> - 2013-06-05 16:27:53
|
On Wed, Jun 5, 2013 at 9:13 AM, Sudheer Joseph <sud...@ya...>wrote: > Dear Users, > Is there any other method in matplotlib to get the plot > similar to the one there in below link? > > > http://dsnra.jpl.nasa.gov/software/Python/scikits/lib.plotting.examples.html > I tried using this package but get below error. > > sjo@sjo-ltp../hourly_rama~$ python ts.py > Traceback (most recent call last): > File "ts.py", line 12, in <module> > fsp = fig.add_tsplot(111) > File > "/usr/local/lib/python2.7/dist-packages/scikits.timeseries-0.91.3-py2.7-linux-x86_64.egg/scikits/timeseries/lib/plotlib.py", > line 1284, in add_tsplot > return add_generic_subplot(self, *args, **kwargs) > File > "/usr/local/lib/python2.7/dist-packages/scikits.timeseries-0.91.3-py2.7-linux-x86_64.egg/scikits/timeseries/lib/plotlib.py", > line 177, in add_generic_subplot > if key in figure_instance._seen: > AttributeError: 'TimeSeriesFigure' object has no attribute '_seen' > > ######################################## > > import numpy as np > import matplotlib.pyplot as plt > import scikits.timeseries as ts > import scikits.timeseries.lib.plotlib as tpl > from scikits.timeseries.lib.moving_funcs import mov_average_expw > > # generate some random data > data = np.cumprod(1 + np.random.normal(0, 1, 300)/100) > series = ts.time_series(data, > start_date=ts.Date(freq='M', year=1982, month=1)) > fig = tpl.tsfigure() > fsp = fig.add_tsplot(111) > fsp.tsplot(series, '-', mov_average_expw(series, 40), 'r--') > plt.show() > > Pandas has excellent time series handling and plotting capabilities. http://pandas.pydata.org/pandas-docs/stable/timeseries.html http://pandas.pydata.org/pandas-docs/stable/visualization.html |