<jupyter_start><jupyter_text>Inspired from [<NAME>'s post](https://www.reddit.com/r/dataisbeautiful/comments/6m0wo7/peak_time_for_sports_and_leisure_oc/djy1i3h/) and his original [code](https://github.com/halhen/viz-pub/blob/master/sports-time-of-day/2_gen_chart.R) in R<jupyter_code>%pylab inline
import seaborn as sns
import pandas as pd

plt.rcParams['savefig.dpi'] = 100
plt.rcParams['figure.dpi'] = 100

sns.set_style('white')
# Extracted from https://github.com/halhen/viz-pub/blob/master/sports-time-of-day/2_gen_chart.R#L33
df_act = pd.read_csv('data/activity2.csv')
df_act['time'] = df_act['time']/60.0 # In hours
df_act.head()
sns.set_context('paper', font_scale=1.1)
fig = plt.figure(figsize=(20,20))
g = sns.FacetGrid(df_act, row='activity', size=0.5, aspect=20)
g = (g.map(plt.fill, 'time', 'p_smooth', color='#2A7FFF', clip_on=False, alpha=1)).despine(left=True, bottom=True)
g.set(yticks=[])
g.set(yticklabels=[])
g.set(title='')
g.set(xlabel='')
g.set(ylabel='')
colors = ['#2A7FFF', '#5599FF']
for index, ax in enumerate(g.axes.ravel()):
    ax.set_ylabel(g.row_names[index], rotation=0, labelpad=60)
    ax.patches[0].set_color(colors[index%2])
    ax.set_clip_on(False)
    

ax = g.axes.ravel()[-1]
ax.minorticks_on()
ax.tick_params('both', length=7, width=2, which='major')
ax.tick_params('both', length=5, width=1, which='minor')
ax.fill(color='red')
ax.set_clip_on(False)

g.set(xticks=range(int(df_act['time'].min()), 28, 3))
xlabels = map( lambda x : '{}:00'.format(x % 24), range(int(df_act['time'].min()), 28, 3))
g.set_xticklabels(xlabels)

#plt.tight_layout()
plt.subplots_adjust(hspace=0)

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20421686746987952, 'fraction_numerical': 0.035542168674698796, 'mean_word_length': 6.515837104072398, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '460677', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 752, 'n_tokens_neox': 708, 'n_words': 98, 'path': 'pyjoyplot.ipynb', 'repo_name': 'saketkc/pyjoyplot', 'size': '1669'}