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)
    
dt = data['controller_rw_time']

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(dt[b][p]) * 1000 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')
    
    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('time to read/write pos/speed/load (in ms)')
    plt.title("BOARDS COMPARISON")
    savefig('controller.png')



In [ ]: