Пример #1
0
def get_pretty_xy_plot(x, y, xlabel, ylabel, filename, y_errorbar=None, save_figure = True):
    cmap = brewer2mpl.get_map('Set1', 'qualitative', 9)
    p = Ppl(cmap, alpha=1)
    fig, ax = plt.subplots(1)    
    ax.set_xlabel(pfn(xlabel))
    ax.set_ylabel(pfn(ylabel))
    ax.yaxis.get_major_formatter().set_powerlimits((0, 1))
    print "Errorbar: %s"%y_errorbar
    if y_errorbar is not None: ax.errorbar(x, y, yerr=y_errorbar, fmt='o')
    p.plot(ax, x, y, linewidth=2,)
    if save_figure: fig.savefig(filename)
    return ax, fig
Пример #2
0
def make_pretty_scatter_plot(x, y, xlabel, ylabel, filename, ax=None, fig=None):
    cmap = brewer2mpl.get_map('Set1', 'qualitative', 9)
    p = Ppl(cmap, alpha=0.3)
    if (not ax) and (not fig):
        fig, ax = plt.subplots(1)    
    ax.set_xlabel(pfn(xlabel))
    ax.set_ylabel(pfn(ylabel))
    ax.set_xlim([min(x), max(x)])
    ax.set_ylim([min(y), max(y)])
    ax.yaxis.get_major_formatter().set_powerlimits((0, 1))

    p.scatter(ax, x, y, s=5, linewidth=0)

    fig.savefig(filename)