コード例 #1
0
with saved_figure('effect_of_zlb.pdf', nrows=2, ncols=2) as (fig, ax):
    
    not_mean.plot(ax=ax[0, 0], linewidth=2) 
    ax[0, 0].fill_between(not_q16.index, not_q16, not_q84, alpha=0.3)
    not_mean_low_me.plot(ax=ax[0, 0], linewidth=2, linestyle='dashed', color='red') 
    ax[0, 0].set_title(r'Notional Interest Rate',fontsize=16)
    ax[0, 0].set_xlim(['2007Q4','2014Q1'])
    ax[0, 0].get_xaxis().set_minor_locator(MultipleLocator(4))
    ax[0, 0].tick_params('x',length=5,width=1,which='minor',direction='in',labelsize=14,pad=5)
    ax[0, 0].set_xticks(['2008Q3','2009Q3','2010Q3','2011Q3','2012Q3','2013Q3'])
    ax[0, 0].tick_params('x', length=0,width=0,which='major',direction='in',labelsize=12,pad=5)
    ax[0, 0].set_xticklabels(['2008','2009','2010','2011','2012','2013'])
    ax[0, 0].tick_params('y',labelsize=14)
    ax[0, 0].grid(False)
    despine()
    
    gdp_mean.plot(ax=ax[0, 1], linewidth=2)
    ax[0, 1].fill_between(gdp_q16.index, gdp_q16, gdp_q84, alpha=0.3)
    gdp_mean_low_me.plot(ax=ax[0, 1], linewidth=2, linestyle='dashed', color='red') 
    ax[0, 1].set_title(r'Output',fontsize=16)
    ax[0, 1].set_xlim(['2007Q4','2014Q1'])
    ax[0, 1].get_xaxis().set_minor_locator(MultipleLocator(4))
    ax[0, 1].tick_params('x',length=5,width=1,which='minor',direction='in',labelsize=14,pad=5)
    ax[0, 1].set_xticks(['2008Q3','2009Q3','2010Q3','2011Q3','2012Q3','2013Q3'])
    ax[0, 1].tick_params('x', length=0,width=0,which='major',direction='in',labelsize=12,pad=5)
    ax[0, 1].set_xticklabels(['2008','2009','2010','2011','2012','2013'])
    ax[0, 1].tick_params('y',labelsize=14)
    ax[0, 1].set_yticklabels(np.arange(-4,2,1))
    ax[0 ,1].set_ylim([-4,1])
    ax[0, 1].grid(False)
コード例 #2
0
        index = p.period_range(freq='Q', start='1983Q1', periods=80)
    else:
        index = p.period_range(start='2003Q1', freq='Q', periods=44)


    reps = filter(lambda x: x.isdigit(), results['output'].keys())

    T = len(index)
    sim_results = p.DataFrame()
    for r in reps:
        time_series = [results['output'][r]['mean_filtered_states']['{:03d}'.format(n+1)]
                       for n in range(T)]

        res_r = p.DataFrame(np.array(time_series), index=index, columns=var_names)
        res_r['sim'] = int(r)
        sim_results = sim_results.append(res_r)

    stds.append(sim_results.groupby(sim_results.index).std())
    means.append(sim_results.groupby(sim_results.index).mean())

cp = figure_defaults(n=5)
with saved_figure(args.output) as (fig,ax):
    for i, std in enumerate(stds):
        std.g.plot(ax=ax, linewidth=5, color=cp[i])

    ax.legend(['BSPF, M=40k', 'TPF(r*=2), M=40k', 'TPF(r*=3), M=40k',
               'TPF(r*=2), M=4k', 'TPF(r*=3), M=4k'], loc='lower right', ncol=2)

    despine()