from jhplot import *
from jhpro.tseries import *
# create time series data
data="""
/*
Description goes here.
10 observations starting from 1970 (1st quarter),
and finishing in 1972 (2nd quarter)
*/
3 1970.1 4
inve income profit
0.00551 0.01057 0.00435
0.02297 0.02211 0.00041
0.03783 0.01636 0.01178
0.09436 0.03193 0.01015
0.01359 0.02138 0.00218
0.02445 0.00192 0.00283
0.03325 0.03581 0.00656
0.07644 0.01471 0.00032
0.00086 0.01808 0.00512
0.02159 0.02827 0.08169
"""
file = open("tseries.dat", "w")
file.write(data)
file.close()
# reading this file and showing
js=HStatData("Data","tseries.dat")
ind1=1 # 2nd column vs time
y=js.getColumn(ind1)
t=js.getTS()[0]
rr=t.range() # time ranges
names=js.getVarNames().vec()
pp=P1D(names[ind1])
pp.setDrawLine(1) # show as connected lines
for j in range(t.numOfObs()):
dd=rr.dateForIndex(j)
pp.add(dd.doubleValue(),y[j])
c1=HPlot()
c1.setMarginLeft(90)
c1.visible(); c1.setAutoRange()
c1.setNameX("Time")
c1.setNameY(names[ind1])
c1.draw(pp)
Ads help maintain this website.