示例#1
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    nr = 5
    nc = len(alt_model_par) + 1

    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    idx = 0
    for key in alt_model_par:
        subplots = np.arange(nr)*nc + 1 + idx
        idx += 1
        ax_list = [fig.add_subplot(nr, nc, x) for x in subplots]
        imVec = plot_parscan(fig, ax_list, key, data1D)

    subplots = np.arange(nr)*nc + nc
    ax_list = [fig.add_subplot(nr, nc, x) for x in subplots]
    add_color_bars(fig, ax_list, imVec)

    plt.tight_layout(pad=1, h_pad=2.5, w_pad=1.5)
    fig.savefig(fig_Folder / figureName,
                format="pdf", transparent=True)

    return None
示例#2
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    # load data or compute model
    Output, InvPerHost = load_model_single()

    # set fonts
    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    # plot average investment
    ax = fig.add_subplot(1, 4, 1, projection='3d')
    plot_3D(ax, data1D, 1)
    ax.set_title('Birth rate effect $(s_b,s_d)=(1,0)$')
    ax = fig.add_subplot(1, 4, 2, projection='3d')
    ax.set_title('Death rate effect $(s_b,s_d)=(0,0.5)$')
    plot_3D(ax, data1D, 0)
    ax = fig.add_subplot(1, 4, 3)
    plot_heatmap(fig, ax, data1D)

    axs = fig.add_subplot(1, 4, 4)
    plot_histogram_line(axs, InvPerHost)

    plt.tight_layout(pad=1, h_pad=2.5, w_pad=0.5)
    fig.savefig(fig_Folder / figureName, format="pdf", transparent=True)

    return None
示例#3
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    #manual set subplot axis
    bm = 0.15
    tm = 0.06
    h = [(1 - bm - tm), (1 - bm - tm) * 0.6]

    lm = 0.05
    rm = 0.05
    cmh = 0.15
    wt = (1 - rm - lm - cmh)
    wf = 0.6
    w = [wf * wt, (1 - wf) * wt]
    left = [lm, lm + w[0] + cmh]
    bot = [bm, bm]

    # plot average investment
    ax = fig.add_axes([left[0], bot[0], w[0], h[0]], projection='3d')
    plot_3D(ax, data1D)
    ax = fig.add_axes([left[1], bot[1], w[1], h[1]])
    plot_heatmap(fig, ax, data1D)
    fig.savefig(fig_Folder / figureName, format="pdf", transparent=True)

    return None
示例#4
0
def create_fig():
    # load data or compute model
    Output, InvPerHost = load_model()
    # set fonts
    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    # plot average investment
    axs = fig.add_subplot(1, 2, 1)
    plot_line(axs, Output, "F_mav")
    axs = fig.add_subplot(1, 2, 2)
    plot_histogram_line(axs, InvPerHost)
    plt.tight_layout(pad=0.2, h_pad=0.5, w_pad=0.5)

    fig.savefig(fig_Folder / figureName, format="pdf", transparent=True)
    return None
示例#5
0
def create_fig():
    # set settings
    n0 = 1E-4
    mig1 = 0.5 * n0
    mig_vec_rel = [0.1, 0.5, 2, 10]

    # setup manual axis for subplots
    bm = 0.22
    tm = 0.06
    cm = 0.05
    h = (1 - bm - cm - tm) / 2
    lm = 0.08
    rm = 0
    cmh = 0.18
    w1 = 0.4
    w2 = 1 - w1 - cmh - rm - lm
    h3 = 0.1
    tm3 = 0.05
    h2 = 1 - h3 - cm - bm - tm3

    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)
    ax = fig.add_axes([lm, bm + cm + h, w1, h])
    plot_ver_hor_cell(ax, n0, mig1)

    ax = fig.add_axes([lm, bm, w1, h])
    plot_verFracl(ax, n0, mig_vec_rel)
    ax.annotate('$\\frac{\\theta/\\beta}{n_0/k}=$',
                xy=(w1 + lm + 0.02, bm + h * 1.2),
                xycoords='figure fraction',
                horizontalalignment='left',
                verticalalignment='top')

    ax = fig.add_axes([lm + cmh + w1, bm, w2, h2])
    cbaxes = fig.add_axes([lm + cmh + w1, h2 + bm + cm, w2, h3])
    plot_tauH_heatmap(fig, ax, cbaxes)

    #plt.tight_layout(pad=0.2, h_pad=0.5, w_pad=0.5)
    fig.savefig(fig_Folder / figureName, format="pdf", transparent=True)

    return None
示例#6
0
def create_fig():
    
    # load data or compute model
    Output = load_model()
    # set fonts
    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)
    
    
    numcost = len(cost_vec)
    
    numElTot = Output.shape[0]
    numElLoc = numElTot/numcost
    
    legendLoc = 'lower right'
    for i in range(numcost):
        
        if i == 0:
            yAxis = True
        else:
            yAxis = False
            
        if i>1:
            legendLoc = 'none'
        
        startP = int(i*numElLoc)
        endP = int((i+1)*numElLoc)
        currOutput = Output[startP:endP,:]
        # plot average investment
        axs = fig.add_subplot(1, 5, i+1)
        plot_line(axs, currOutput, "F_mav", yAxis, maxT_vec[i], legendLoc)
        axs.set_title('Cost $\\gamma=%.3f$' % cost_vec[i])
        
#    axs = fig.add_subplot(1, 2, 2)
#    plot_histogram_line(axs, InvPerHost)
    plt.tight_layout(pad=0.2, h_pad=0.5, w_pad=0.5)

    fig.savefig(fig_Folder / figureName,
                format="pdf", transparent=True)
    return None
示例#7
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    # settings
    cost_vec = [0.001, 0.01, 0.1]
    # setup manual axis for subplots
    bm = 0.25
    tm = 0.02
    cm = 0.12
    #h = (1 - bm - tm - cm) / 2
    h = 1 - bm - tm
    lm = 0.08
    rm = 0.03
    cmh = 0.12
    w = (1 - cmh - rm - lm) / 2

    # set fonts
    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    ax = fig.add_axes([lm, bm, w, h])
    plot_helper_frac(ax, cost_vec)
    ax.annotate('$\\gamma=$',
                xy=(w+lm-0.12, bm+h*0.7), xycoords='figure fraction',
                horizontalalignment='left',
                verticalalignment='top')

    ax = fig.add_axes([lm+cmh+w, bm, w, h])
    plot_tau_var(ax, data1D)
    ax.annotate('$\\sigma=$',
                xy=(w+lm+cmh+0.05, bm+h), xycoords='figure fraction',
                horizontalalignment='left',
                verticalalignment='top')

    fig.savefig(fig_Folder / figureName,
                format="pdf", transparent=True)

    return None
示例#8
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    # setup manual axis for subplots
    bm = 0.15
    tm = 0.06
    cm = 0.13
    hf = 0.65
    h = [hf*(1 - bm - cm - tm), (1-hf)*(1 - bm - cm - tm)]
    lm = 0.05
    rm = 0.05
    cmh = 0.1
    w = (1 - cmh - rm - lm)/2
    wf = 0.85
    wo = (1-wf)*w
    left = [lm, lm+cmh+w]
    bot = [bm+h[1]+cm, bm]

    # plot for different sampling variance
    for ss in range(2):
        # plot scatter
        ax = fig.add_axes([left[ss], bot[0], w, h[0]], projection='3d')
        plot_3D(ax, data1D, ss)
        ax.set_title('$\\sigma={}$'.format(sigma_vec[ss]), fontsize=6)
        # plot heatmap
        ax = fig.add_axes([left[ss]+wo, bot[1], wf*w, h[1]])
        plot_heatmap(fig, ax, data1D, ss)
    plt.show()

    #plt.tight_layout(pad=1, h_pad=2.5, w_pad=1.5)
    fig.savefig(fig_Folder / figureName,
                format="pdf", transparent=True)

    return None
示例#9
0
def create_fig():
    # load data or compute model
    data1D = load_model()
    data1D = process_data(data1D)

    # set fonts
    fig = plt.figure()
    mlsg.set_fig_size_cm(fig, wFig, hFig)

    # plot average investment
    ax = fig.add_subplot(1, 3, 1, projection='3d')
    plot_3D(ax, data1D, 1)
    ax.set_title('Brith rate effect $s_b=1$')
    ax = fig.add_subplot(1, 3, 2, projection='3d')
    ax.set_title('No brith rate effect $s_b=0$')
    plot_3D(ax, data1D, 0)
    ax = fig.add_subplot(1, 3, 3)
    plot_heatmap(fig, ax, data1D)

    plt.tight_layout(pad=1, h_pad=2.5, w_pad=0.5)
    fig.savefig(fig_Folder / figureName, format="pdf", transparent=True)

    return None