The n-second rule

(0 comments)

How long have you got before a piece of food dropped on the floor is unsafe to eat?

Google has the answer.

enter image description here

import matplotlib.pyplot as plt
import numpy as np

import matplotlib
matplotlib.rcParams['font.family'] = 'sans-serif'
matplotlib.rcParams['font.sans-serif'] = 'Lato'
csfont = {'fontname':'Lato Regular'}

LIGHT_GREY = '#dddddd'
BAR_COLOUR = '#438ec8'

# Number of Google hits for "<n>-second-rule" (n = 0 - 10)
second_counts = np.array([32300, 51600, 66200, 40900, 12600, 236000, 7040,
                          19200, 5230, 1340, 28000])
n = len(second_counts)

# Draw a horizontal bar chart.
fig, ax = plt.subplots()
ax.barh(range(n), second_counts/1000, align='center', fc=BAR_COLOUR,
       alpha=0.8, ec='none')
# Make it look better.
ax.set_ylim(n-0.5, -0.5)
ax.set_ylabel('Number of seconds')
ax.set_yticks(range(n))
ax.set_xlabel('Number of hits (1000s)')
ax.set_title('Number of Google hits for the n-second rule (n=0–10)')

ax.xaxis.grid(which='major', c=LIGHT_GREY, lw=2, ls='-')
ax.tick_params(axis='y', length=0)
ax.tick_params(axis='x', length=0)
for spine in ('top', 'bottom'):
    ax.spines[spine].set_visible(False)
for spine in ('left', 'right'):
    ax.spines[spine].set_linewidth(2)
    ax.spines[spine].set_color(LIGHT_GREY)
ax.set_axisbelow(True)

plt.savefig('n-second-rule.png')
plt.show()
Currently unrated

Comments

Comments are pre-moderated. Please be patient and your comment will appear soon.

There are currently no comments

New Comment

required

required (not published)

optional

required