In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
import pickle 

with open('data.pickle') as f:
    data = pickle.load(f)
    
cpu_load = data['cpu_usage']

In [3]:
to_plot = (('dell', '2.7.8'),
           ('dell', 'pypy-2.3.1'),

           ('odroid', '2.7.8'),
           ('odroid', 'pypy-2.3.1'),
           
           ('pi', '2.7.8'),
           ('pi', 'pypy-2.3.1'))

In [5]:
indices = array([0.5, 1.0, 
                 2.0, 2.5,
                 3.5, 4.0])

width = 0.4

with xkcd():
    fig = plt.figure()
    ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
    
    x = array([mean(cpu_load[b][p]) for b, p in to_plot])
    
    i = arange(0, len(x), 2)
    ax.bar(indices[i], x[i], width, color='r')
    
    i = arange(1, len(x), 2)
    ax.bar(indices[i], x[i], width, color='g')
    #for i in range(0, len(x), 2):
    #ax.bar(indices, x, width)
    
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')

    ax.set_xticks(indices + width/2)
    
    ax.set_xticklabels(['2.7.8\n               PC',
                        'PyPy',
                        '2.7.8\n             Odroid',
                        'PyPy',
                        '2.7.8\n                Raspberry pi',
                        'PyPy'])

    plt.ylabel('cpu load (%)')
    plt.title("BOARDS COMPARISON")
    savefig('cpu_usage.png')



In [ ]: