import csv
import pandas aspd
import numpy as np
import matplotlib.pyplot asplt
import seaborn as sns
%matplotlib inline
df=pd.read_csv('csv/gaku-mg1712_02_21ver3.csv', encoding='shift_jis',
parse_dates={'date':['nominal time series']}, index_col='date')
#gdpDate=df['1994-03-01':'1994-12-01',df['Gross Domestic Product']]
#df ['Gross Domestic Product']
# Create a histogram based on the average and variance of every five years??
searchData1 = df.iloc [np.where('1994-03-01'<=df.index)&(df.index<='1999-12-01')]
searchData2 = df.iloc [np.where('2000-03-01'<=df.index)&(df.index<='2004-12-01')]
searchData3 = df.iloc [np.where('2005-03-01'<=df.index)&(df.index<='2009-12-01')]
searchData4 = df.iloc [np.where('2010-03-01'<=df.index)&(df.index<='2015-12-01')]
sns.set()
sns.set_context("notebook")
plt.figure(figsize=(16,9))
sns.distplot(searchData1['Gross Domestic Product', '),
hist=False,
kde_kws={"color":"k", "lw":3, "label":"gdp_1995-2000"}, #Describe legend color, line thickness, and name
axlabel='gdp'
)
sns.distplot(searchData2['Gross Domestic Product'],
hist=False,
kde_kws={"color":"b", "lw":3, "label":"gdp_2000-2005"}, #Describe legend color, line thickness, and name
axlabel='gdp'
)
sns.distplot(searchData3['Gross Domestic Product'],
hist=False,
kde_kws={"color":"r", "lw":3, "label":"gdp_2005-2010"}, #Describe legend color, line thickness, and name
axlabel='gdp')
sns.distplot(searchData4['Gross Domestic Product'],
hist=False,
kde_kws={"color":"y", "lw":3, "label":"gdp_2010-2015"}, #Describe legend color, line thickness, and name
axlabel='gdp')
The curve will stick out.How can I improve it?
Couldn't you adjust with ylim?
plt.ylim ([0.0,0.0002])
© 2024 OneMinuteCode. All rights reserved.