ECE 4760 Boid Lab Statistics

V. Hunter Adams (vha3), Fall 2021

In [1]:
import numpy
import matplotlib.pyplot as plt
%matplotlib inline

Boid numbers

In [2]:
boids = {'Boid Boys': 700,
#          'Purple Pandemonium': 1,
         'Awesome Group': 350,
         'Your Neighbor Boid': 300,
         'Volatile': 185,
         'Boids By Daylight': 175,
         'Boids will be Boids': 150,
         'I am Boid in class': 90,
         'Boids of Prey': 130,
         'The chirping chaps': 180,
         'Into the Boid': 100,
         'Flock this Boid': 250,
         'The Backstreet Boids': 115,
         'Society': 185,
         'Oh Boid!': 500,
         'One Boid to rule them all': 190,
         'Game Boid Advance': 120,
         'Boid is the Word': 216,
         'Angry Boids': 420}
boids = dict(sorted(boids.items(), key=lambda x: x[1], reverse=True))

Plot

In [3]:
plt.rcParams['figure.figsize'] = [20, 5.5]
plt.boxplot(list(boids.values()), meanline=True, showmeans=True, whis=1., vert=False, widths=10.5,
            boxprops={'linewidth': 3}, whiskerprops={'color':'black', 'linewidth': 3},
            capprops={'linewidth': 3}, medianprops={'color':'black', 'linewidth': 2},
            meanprops={'linewidth': 2}, flierprops={'markerfacecolor':'black',
                                                                     'markeredgecolor': 'black',
                                                                     'markersize': 10})


plt.title('ECE 4760 Boids Statistics', fontsize=24)
plt.xlabel('Number of Boids at 30fps', fontsize=24)
plt.yticks(fontsize=18, visible=False)
plt.xticks(fontsize=18, visible=True)


# X/y limits
plt.ylim([-(15+5*len(boids)), 16])

counter = 0 
for i in list(boids.keys()):
    plt.annotate(str(i)+': '+str(boids[i]),
                 xy=(boids[i], -(15+5*counter)), xytext=(boids[i],-(15+5*counter)), fontsize=8, alpha=.8)
    plt.plot(boids[i]*numpy.ones(20), numpy.linspace(-(15+5*counter),-10,20),
             'black', alpha=0.1)
    counter += 1

plt.plot(list(boids.values()), -10*numpy.ones(len(list(boids.values()))), 'r.', alpha=0.5, markersize=15)

plt.savefig('Boid.png', bbox_inches='tight')
plt.show()
In [ ]: