In [1]:
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as dts
import random
from fredclass import fred
%matplotlib inline


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-a47ea201e1cf> in <module>()
      4 import matplotlib.dates as dts
      5 import random
----> 6 from fredclass import fred
      7 get_ipython().magic(u'matplotlib inline')

ImportError: No module named fredclass

In [2]:
# # 0. Setup: Formatting commands and definitions.

# # 0.1 general plot settings

# # Make all plotted axis lables and tick lables bold 15 pt font
# font = {'weight' : 'bold',
#         'size'   : 15}
# axes={'labelweight' : 'bold'}
# plt.rc('font', **font)
# plt.rc('axes', **axes)

# # Add some space around the tick lables for better readability
# plt.rcParams['xtick.major.pad']='8'
# plt.rcParams['ytick.major.pad']='8'

# # 0.2 Formatter for inserting commas in y axis labels with magnitudes in the thousands

# def func(x, pos):  # formatter function takes tick label and tick position
#    s = '{:0,d}'.format(int(x))
#    return s

# y_format = plt.FuncFormatter(func)  # make formatter

# # 0.3 format the x axis ticksticks
# years2,years4,years5,years10,years15= dts.YearLocator(2),dts.YearLocator(4),dts.YearLocator(5),dts.YearLocator(10),dts.YearLocator(15)


# # 0.4 y label locator for vertical axes plotting gdp
# majorLocator_y   = plt.MultipleLocator(3)
# majorLocator_shares = plt.MultipleLocator(0.2)

In [2]:
gdp = fred('A939RX0Q048SBEA')
unemp = fred('UNRATE')
cpi = fred('CPIAUCSL')
tbill= fred('')
y.apc()
# y.bpfilter()

In [2]:
fig = plt.figure()

ax = fig.add_subplot(1, 1, 1)
ln1 = ax.plot_date(y.bpdatenums,y.bpcycle,'b-',lw = 3)
plt.grid()
# ax.xaxis.set_major_locator(years5)
# y.recessions()
# ax.set_title('Interest rates',fontsize=15)
# plt.setp(ax1.get_xticklabels(), visible=False)
# ax1.set_ylabel('%')
# ax1.locator_params(axis='y',nbins=4)

# plt.tight_layout()
# plt.savefig('fig_004_usdJpy.png',bbox_inches='tight',dpi=120)

In [2]:


In [2]:


In [2]:


In [ ]: