In [144]:
import sys
sys.path.insert(0,'/home/lonnie/git/MiCA/tools')

In [263]:
import micavis.ipython as mv
_ = reload(mv)


[micavis.ipython at micavis.ipython loaded Sun Dec 16 21:54:53 2012]

In [146]:
pdf_dir = "/home/lonnie/splash2011/popl2013-extended/experiments/"
column_width = 4.  # inches

In [273]:
def gossip_histogram(snapshot,expname):
    datasets = snapshot.keywords['datasets']
    legends = [u'dilation-0', u'dilation-1', u'dilation-2', u'dilation-3', u'dilation-4']
    #nbins = snapshot.keywords['nbins']
    nb = 40
    bw = 10./nb
    nbins = [x*bw for x in range(nb)]
    normalize = True
    xlabel = 'Interval between gossiping (rounds)'
    ylabel = 'Fraction of intervals'
    colors = ['blue','green','red','purple']
    fig = plt.figure(figsize=(column_width*2,6))
    for i,sp in enumerate([221,222,223,224]):
        ax = fig.add_subplot(sp)
        artists = []
        
        data = datasets[i].copy()
        if normalize:
            tot = float(sum(data))
            weights = data/tot
        else:
            weights = None
        n,bins,patches = ax.hist(data, nbins, histtype='stepfilled',label=legends[i], color=colors[i], weights = weights)
        ax.grid(True)
        ax.set_ylabel(ylabel)
        ax.set_xlabel(xlabel)
        ax.legend()
    
    fig.savefig("%s/dilation_normed_%s.pdf" % (pdf_dir, expname))
    plt.show()

In [274]:
snapshot = mv.load(pdf_dir + "dilation_complete_n1000.pickle")
gossip_histogram(snapshot, "b_n1000")



In [ ]: