示例#1
0
def make_plot():
    import matplotlib as mpl
    mpl.use('Agg')
    import matplotlib.pyplot as plt
    import seaborn as sns
    from plotting import legends, colors, linewidths, linestyles, alphas, interpolate_values
    fsize = 20
    mpl.rcParams.update({
        # 'font.size': fsize,
        'legend.fontsize': 15,
        'axes.titlesize': fsize,
        # 'axes.labelsize': fsize,
        'xtick.labelsize': fsize,
        'ytick.labelsize': fsize,
        'axes.labelsize': fsize
    })
    # sns.set_style('ticks')  # hm, it actually works here
    fig, ax = plt.subplots()
    fig.tight_layout()
    plt.gcf().subplots_adjust(bottom=0.16, left=0.2, right=0.78, top=0.95)

    plots = {}
    for meth, vals in timeinfo.items():
        if vals.count(None) >= len(vals) - 1:
            print '  not enough vals for %s' % meth
            continue
        interpolate_values(n_query_list, vals)
        if meth == 'seed-partition':
            nql = n_query_list_seed
        else:
            nql = n_query_list
        print '%30s  %s' % ('', ''.join([('%7d' % t) for t in nql]))
        print '%30s  %s' % (meth, ''.join(
            [('%7.0f' % val) if val is not None else '  n  ' for val in vals]))
        plots[meth] = ax.plot(nql,
                              vals,
                              linewidth=linewidths.get(meth, 4),
                              label=legends.get(meth, meth),
                              color=colors.get(meth, 'grey'),
                              linestyle=linestyles.get(meth, 'solid'),
                              alpha=alphas.get(meth, 1.))  #, markersize=1000)

    legend = ax.legend(loc=(.04, .64))  # 'upper left')
    sns.despine()  #trim=True, bottom=True)
    plt.xlabel('sample size')
    plt.ylabel('time required')
    plt.subplots_adjust(bottom=0.14, left=0.18)
    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.grid(True)
    yticks = [1, 60, 3600, 86400, 604800]  # seconds
    yticklabels = ['1 sec', '1 min', '1 hour', '1 day', '1 week']
    plt.yticks(yticks, yticklabels)
    plt.savefig(os.getenv('www') + '/partis/clustering/time-required.svg')
    sys.exit()
示例#2
0
def make_plot():
    import matplotlib as mpl
    mpl.use('Agg')
    import matplotlib.pyplot as plt
    import seaborn as sns
    from plotting import legends, colors, linewidths, linestyles, alphas, interpolate_values
    fsize = 20
    mpl.rcParams.update({
        # 'font.size': fsize,
        'legend.fontsize': 15,
        'axes.titlesize': fsize,
        # 'axes.labelsize': fsize,
        'xtick.labelsize': fsize,
        'ytick.labelsize': fsize,
        'axes.labelsize': fsize
    })
    # sns.set_style('ticks')  # hm, it actually works here
    fig, ax = plt.subplots()
    fig.tight_layout()
    plt.gcf().subplots_adjust(bottom=0.16, left=0.2, right=0.78, top=0.95)
    
    plots = {}
    for meth, vals in timeinfo.items():
        if vals.count(None) >= len(vals) - 1:
            print '  not enough vals for %s' % meth
            continue
        interpolate_values(n_query_list, vals)
        if meth == 'seed-partition':
            nql = n_query_list_seed
        else:
            nql = n_query_list
        print '%30s  %s' % ('', ''.join([('%7d' % t) for t in nql]))
        print '%30s  %s' % (meth, ''.join([('%7.0f' % val) if val is not None else '  n  ' for val in vals]))
        plots[meth] = ax.plot(nql, vals, linewidth=linewidths.get(meth, 4), label=legends.get(meth, meth), color=colors.get(meth, 'grey'), linestyle=linestyles.get(meth, 'solid'), alpha=alphas.get(meth, 1.))  #, markersize=1000)
    
    legend = ax.legend(loc=(.04, .64)) # 'upper left')
    sns.despine()  #trim=True, bottom=True)
    plt.xlabel('sample size')
    plt.ylabel('time required')
    plt.subplots_adjust(bottom=0.14, left=0.18)
    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.grid(True)
    yticks = [1, 60, 3600, 86400, 604800]  # seconds
    yticklabels = ['1 sec', '1 min', '1 hour', '1 day', '1 week']
    plt.yticks(yticks, yticklabels)
    plt.savefig(os.getenv('www') + '/partis/clustering/time-required.svg')
    sys.exit()
示例#3
0
    plots = {}
    for meth, vals in timeinfo.items():
        interpolate_values(n_query_list, vals)

        linestyle = '-'
        alpha = 1.
        if 'vollmers' in meth:
            alpha = 0.5
        if 'vsearch' in meth:
            linestyle = '-.'
        elif 'naive-hamming-partition' in meth:
            linestyle = '--'
        elif 'true' in meth:
            linestyle = '--'
            alpha = 0.5
        plots[meth] = ax.plot(n_query_list, vals, linewidth=linewidths.get(meth, 4), label=legends.get(meth, meth), color=colors.get(meth, 'grey'), linestyle=linestyle, alpha=alpha)  #, markersize=1000)
    
    legend = ax.legend(loc='upper left')
    sns.despine(trim=True, bottom=True)
    plt.xlabel('sample size')
    plt.ylabel('time required')
    plt.subplots_adjust(bottom=0.14, left=0.18)
    ax.set_xscale('log')
    ax.set_yscale('log')
    yticks = [1, 60, 3600, 86400, 604800]  # seconds
    yticklabels = ['1 sec', '1 min', '1 hour', '1 day', '1 week']
    plt.yticks(yticks, yticklabels)
    plt.savefig(os.getenv('www') + '/partis/clustering/time-required.svg')
    sys.exit()

# ----------------------------------------------------------------------------------------