Exemple #1
0
def plot(x, y, z, save):
    """Plots a test image of the Bivariate Gaussian
    
    Required Inputs
        x,y,z   :: arrays        :: must all be same length
        save    :: string / bool :: save location or '' / False
    """

    pp = Pretty_Plotter()
    pp.s = 1.0
    pp._teXify()  # LaTeX

    fig = plt.figure(figsize=(5, 5))
    ax = fig.add_subplot(111)

    # create contour plot
    c = ax.contourf(x, y, z, 200, cmap=magma)

    # axis labels
    ax.set_xlabel(r'$\phi_1$', fontsize=pp.axfont)
    ax.set_ylabel(r'$\phi_2$', fontsize=pp.axfont)
    ax.grid(False)  # remove grid

    pp.save_or_show(save, PLOT_LOC)
    pass
def plot(lines, save=False):
    """Plots the two-point correlation function
    
    Required Inputs
        itau     :: {(x,y,e)} :: plots (x,y,e) as error bars
        pacc    :: {(x,y,e)} :: plots (x,y,e) as error bars
        # subtitle :: str  :: subtitle for the plot
        # op_name  :: str  :: the name of the operator for the title
        save     :: bool :: True saves the plot, False prints to the screen
    """
    
    pp = Pretty_Plotter()
    pp.s = 1.5
    pp._teXify() # LaTeX
    
    fig, ax = plt.subplots(1, figsize = (10, 8))
    ax = [ax]
    fig.suptitle(r"Showing that $n$ has little effect on $\tau_{\text{int}}$",
        fontsize=pp.ttfont+2)
    
    ax[0].set_title(r"HMC; lattice: $(100,)$; $m=0.01$; $M=10^5$; $\vartheta=\frac{\pi}{2}$", fontsize=pp.ttfont)
    
    ax[-1].set_xlabel(r'$\delta\tau$')
    
    ax[0].set_ylabel(r'$\tau_{\text{int}}$')
    for line in lines:
        m = next(markers)
        c = next(measured_colours)
        
        label = line['n_steps']
        x = line['step_size']
        y = line['itau']
        ax[0].scatter(x, y, alpha=0.5, c=c, marker=m, label=int(label))
    
    for a in ax:
        a.legend(loc='best', shadow=True, fontsize = pp.axfont)
        xi,xf = a.get_xlim()
        a.set_xlim(xmin=xi-0.01*(xf-xi), xmax=xf+0.01*(xf-xi)) # give a decent view of the first point
        
        yi,yf = a.get_ylim()
        a.set_ylim(ymax=yf + .05*(yf-yi), ymin=yi-.05*(yf-yi)) # give 5% extra room at top
    
    ax[0].legend(bbox_to_anchor=(0., -0.3, 1., .102), loc=9,
           ncol=6, mode="expand", borderaxespad=0.)
    fig.subplots_adjust(bottom=0.3)
    
    pp.save_or_show(save, PLOT_LOC)
    pass