How to change Scale width on the graph plots.

9 views
Skip to first unread message

hello-folks

unread,
Mar 7, 2018, 12:39:51 AM3/7/18
to pystatsmodels
I use "UnobservedComponents" with windows10(64)/anaconda3

I try to use this data set.

day,dist
2018-01-27,486.272
2018-01-27,486.272
2018-01-28,486.272
2018-01-29,486.272
2018-01-30,486.272
2018-01-31,486.272
2018-02-01,486.273
2018-02-02,486.272
2018-02-03,486.273
2018-02-04,486.272
2018-02-05,486.273
2018-02-06,486.272
2018-02-07,486.272
2018-02-08,486.272
2018-02-09,486.273
2018-02-10,486.273
2018-02-11,486.272
2018-02-12,486.272
2018-02-13,486.272
2018-02-14,486.272
2018-02-15,486.273
2018-02-16,486.273
2018-02-17,486.272
2018-02-18,486.272
2018-02-18,486.272
2018-02-20,486.272
2018-02-21,486.272
2018-02-22,486.272
2018-02-23,486.272
2018-02-24,486.272
2018-02-25,486.272
2018-02-26,486.272
2018-02-27,486.272
2018-02-28,486.272

dist.csv(distance fluctuation)


This is a python code.

***************************

import numpy as np
import pandas as pd
from scipy import stats

from matplotlib import pylab as plt
import seaborn as sns
%matplotlib inline

from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 15, 6

import statsmodels.api as sm

dateparse = lambda dates: pd.datetime.strptime(dates, '%Y-%m-%d')
data = pd.read_csv('dist.csv', index_col='day', date_parser=dateparse, dtype = {'dist':'float'})
data.head()

ts = data['dist']
ts.head()

plt.plot(ts)

mod_local_level = sm.tsa.UnobservedComponents(ts.values, 'local linear trend')
res_local_level = mod_local_level.fit()
result = np.array(res_local_level.fittedvalues)
np.savetxt('out1.csv',result,delimiter=',', fmt='%0.4f')
np.savetxt('out2.csv',data,delimiter=',', fmt='%0.4f')
print(res_local_level.summary())
rcParams['figure.figsize'] = 15, 15
fig = res_local_level.plot_components()

***************************


I get good result, Thank you!!

So,I'd like to change Scale width on the graph plots.

predicted vs observed
Level component
Trend component

The scale of these graphs is too fine.
unit is mm but Scale width is 0.05mm.

So, please teach me How to chane Scale width

Best Regard



Reply all
Reply to author
Forward
0 new messages