In [2]:
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict

%matplotlib inline

import seaborn as sns
sns.set_style("whitegrid", {"font.family": "DejaVu Sans"})
sns.set_context("poster")

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)

data_set = OrderedDict()
data_set['pUC19'] = {5: 1109, 6: 668, 7: 182, 8: 83, 9: 18, 10: 4, 11: 2, 13: 2}
#data_set['DB'] = {5: 2575}
#data_set['hybrid pUC19+DB'] = {5: 2429, 6: 1868, 7: 640, 8: 186, 9: 44, 10: 10, 11: 8, 13: 2}
data_set['M13'] = {5: 1527, 6: 2679, 7: 1793, 8: 697, 9: 256, 10: 69, 11: 29, 12: 2, 13: 3, 14: 5, 15: 2, 17: 2, 29: 1, 30: 2, 42: 2}
data_set['lambda_phage'] = {5: 203, 6: 5351, 7: 17998, 8: 15532, 9: 6403, 10: 2077, 11: 676, 12: 192, 13: 36, 14: 16, 15: 2}
#data_set['RDM'] = {5: 1, 6: 5013, 7: 23201, 8: 15172, 9: 4847, 10: 1281, 11: 365, 12: 86, 13: 22, 14: 8}

fig, axes = plt.subplots(nrows=1, ncols=3)
fig.set_size_inches(15,5)
#ax0 = axes.flat

bar_width = 0.75

first = True

for ax0, (data_label, data) in zip(axes.flat, data_set.items()):
    max_x = max(14, max(data.keys()) + 1)
    x = np.zeros(max_x)
    for key, value in data.items():
        x[key] = value
    #print x
    #index = np.arange(len(data))
    index = np.arange(5, max_x)
    ax0.bar(index, x[5:], bar_width, label='', linewidth=0) # label=data_label
    ax0.set_xticks(index + bar_width/2)
    if data_label == "M13":
        ax0.set_xticklabels([i if i % 3 == 0 else "" for i in range(5, max_x)], fontsize=12)
    else:
        ax0.set_xticklabels(range(5, max_x), fontsize=14)
    
    ax0.set_yscale('symlog')
    #ax0.set_title('Number of repeats by length')
    ax0.set_xlabel('Length')
    if first:
        ax0.set_ylabel('Repeats')
        first = False
    ax0.set_xlim(4.5, max_x)
    ax0.legend()

axes[0].set_title('pUC19')
axes[1].set_title('M13')
axes[2].set_title(r'$\lambda$-phage')

plt.tight_layout()
plt.show()
#plt.savefig("/home/j3ny/repeats_comparison.pdf",format='pdf',dpi=600)



In [22]:
import matplotlib as mpl
font_paths = mpl.font_manager.findSystemFonts()
font_objects = mpl.font_manager.createFontList(font_paths)
font_names = [f.name for f in font_objects]
#print font_names