Ejemplo n.º 1
0
def sin_test(n=8,text_position='start'):
    """Test the stuff from the modules"""

    from bfmplot import pl
    import bfmplot as bp
    import numpy as np
    #bp.set_color_cycle(bp.cccs_colors)

    #pl.figure(figsize=bp.phys_rev_column())
    pl.figure(figsize=bp.golden_ratio(5))

    x = np.linspace(1,5*np.pi,100)

    for i in range(n):
        pl.plot(x, 1-np.sin(x[::-1]/np.sqrt(i+1)), marker=bp.markers[i],mfc='w',label='$i=%d$'%i)

    bp.strip_axis(pl.gca())

    leg = pl.legend()
    bp.align_legend_right(leg)

    bp.arrow(pl.gca(), r'$i$', 
             (3, 1.8), 
             (6, 0.8), 
             text_position=text_position)


    pl.xlabel('hello')
    pl.ylabel('hello')

    bp.set_n_ticks(pl.gca(), 3, 2)

    #pl.xscale('log')

    pl.gcf().tight_layout()
Ejemplo n.º 2
0
def sin_test(n=8,text_position='start'):

    pl.figure(figsize=bp.golden_ratio(5))

    x = np.linspace(0,5*np.pi,100)

    for i in range(n):
        pl.plot(x, 1-np.sin(x[::-1]/np.sqrt(i+1)), marker=bp.markers[i],mfc='w',label='$i=%d$'%i)

    bp.strip_axis(pl.gca())

    leg = pl.legend()
    bp.align_legend_right(leg)

    bp.arrow(pl.gca(), r'$i$', (14, 0.8), (10, 0.15), text_position=text_position, rad=0.3)    

    pl.xlabel('this is the x-label')
    pl.ylabel('this is the y-label')

    pl.gcf().tight_layout()
Ejemplo n.º 3
0
def sin_test(n=8, text_position='start', with_legend=True):

    pl.figure(figsize=bp.golden_ratio(5))

    x = np.linspace(0, 5 * np.pi, 100)

    for i in range(n):
        pl.plot(x,
                1 - np.sin(x[::-1] / np.sqrt(i + 1)),
                marker=bp.markers[i],
                mfc='w',
                label='$i=%d$' % i)

    bp.strip_axis(pl.gca())

    if with_legend:
        leg = pl.legend()
        bp.align_legend_right(leg)

    pl.xlabel('this is the x-label')
    pl.ylabel('this is the y-label')

    pl.gca().set_title(name)
    pl.gcf().tight_layout()
Ejemplo n.º 4
0
    #        bbox={'facecolor':'w','edgecolor':'w','pad':0}
    #        )

    ax[i].set_xscale('log')
    ax[i].set_yscale('log')
    #ylim = pl.gca().get_ylim()
    #min_ylim = 10**np.floor(np.log(ylim[0])/np.log(10))
    #max_ylim = 10**np.ceil(np.log(ylim[1])/np.log(10))
    #if min_ylim < 1:
    #    min_ylim = 1
    ax[i].set_ylim(ylims[i])
    #ax[i].set_xlim([1,40])
    #if i == 1:
    #    ax[i].set_ylim([10,20000])

    bp.strip_axis(ax[0])
    bp.strip_axis(ax[1])
    #bp.align_legend_right(leg)
    #ax[i].set_yticks([0,10000,20000,30000,40000])
    if i == 0:
        ax[i].set_yticks([1e2, 1e3, 1e4, 1e5])
    else:
        ax[i].set_yticks([1e1, 1e2, 1e3, 1e4])
    #bp.humanify_yticks(ax[i],precision=0 if i == 0 else 1)
    ax[i].set_xlabel('days since Jan. 20th')

#ax[0].text(-0.18,1.03,'A',fontsize=14,fontweight='bold',transform=ax[0].transAxes,va='top')
#ax[1].text(-0.21,1.03,'B',fontsize=14,fontweight='bold',transform=ax[1].transAxes,va='top')

pl.gcf().tight_layout()
                   0.45,
                   "Feb. 2nd".format(p[0]),
                   transform=ax[i].transAxes,
                   ha='center',
                   va='bottom',
                   fontsize=9,
                   bbox={
                       'facecolor': 'w',
                       'edgecolor': 'w',
                       'pad': 0
                   })
    if _r < n_row - 1:
        [x.set_visible(False) for x in ax[i].xaxis.get_major_ticks()]
    ax[i].set_yticks([1, 10, 100, 1000])

    bp.strip_axis(pl.gca())

ax[0].text(-0.4,
           1.1,
           'C',
           transform=ax[0].transAxes,
           ha='left',
           va='top',
           fontweight='bold',
           fontsize=14,
           bbox={
               'facecolor': 'w',
               'edgecolor': 'w',
               'pad': 0
           })
Ejemplo n.º 6
0
    for i in range(len(n_1)):
        for j in range(len(rho_1)):
            t = solve_t(k_1, n_1[i])
            clustering_T[i, j] = (n_1[i] - 1) * (n_1[i] - 2) * triangles(
                t, rho_1[j], NMAX) * 0.5

col = bp.brewer_qualitative[2]
for i in range(6):
    ax.plot(n_1,
            clustering_T[:, i],
            label=r'$\rho={0:3.1f}$'.format(rho_1[i]),
            c=col)

for ax in axes:
    bp.strip_axis(ax)

fig.tight_layout()
#pl.subplots_adjust(wspace=0.15)

for i in range(len(rho_0)):
    label_pos_rel = 0.2 - i / 60.0
    va = 'center'
    if i == len(rho_1) - 1:
        #label_pos_rel = 0.8
        va = 'baseline'
    bp.add_curve_label(
        axes[0],
        k_0,
        clustering_k[:, i],
        r'$\rho={0:3.1f}$'.format(rho_0[i]),
Ejemplo n.º 7
0
if __name__ == "__main__":

    import numpy as np
    import bfmplot as bp
    fig, ax = pl.subplots(1, 1)

    x = np.linspace(1, 10, 100)
    mus = np.linspace(1, 4, 4)

    for mu in mus:
        y = x**mu
        pl.plot(x, y, c=bp.brewer_qualitative[0])

    #pl.xscale('log')
    bp.strip_axis(ax, horizontal='left')
    pl.yscale('log')
    ax.set_xlabel('x')
    ax.set_ylabel('y')

    pl.gcf().tight_layout()
    pl.xlim([1, 10])

    for mu in mus:
        label = r'$\mu={:d}$'.format(int(mu))
        y = x**mu
        add_curve_label(ax, x, y, label, label_pos_rel=0.5 + mu / 50)

    print(human_format(112345, precision=2))

    pl.show()