time series

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@…4372…/hourly_rama~$ python ts.py

Traceback (most recent call last):

File “ts.py”, line 12, in

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()


Sudheer Joseph
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600®,Tel:+91-40-9440832534(Mobile)
E-mail:sjo.India@…287…;sudheer.joseph@…9…
Web- http://oppamthadathil.tripod.com


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

···

On Wed, Jun 5, 2013 at 9:13 AM, Sudheer Joseph <sudheer.joseph@...9...>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@...4371.../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()

Thank you Verymuch for quick help,Paul.

with best regards,

Sudheer

···

From: Paul Hobson <pmhobson@…287…>
To: Sudheer Joseph <sudheer.joseph@…9…>
Cc: “matplotlib-users@…1753…forge.net” matplotlib-users@lists.sourceforge.net
Sent: Wednesday, 5 June 2013 9:57 PM
Subject: Re: [Matplotlib-users] time series

On Wed, Jun 5, 2013 at 9:13 AM, Sudheer Joseph <sudheer.joseph@…9…> 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@…4371…/hourly_rama~$ python ts.py

Traceback (most recent call last):

File “ts.py”, line 12, in

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