Skip to content

Instantly share code, notes, and snippets.

@christopher-beckham
Created May 17, 2019 04:45
Show Gist options
  • Save christopher-beckham/6a400663b400b3dc4fe984e038836e56 to your computer and use it in GitHub Desktop.
Save christopher-beckham/6a400663b400b3dc4fe984e038836e56 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
###########################################################
# dates.txt is created by `git log | grep Date > dates.txt`
###########################################################
hours = []
with open("dates.txt") as f:
for line in f:
hours.append( int(line.rstrip().split()[4].split(":")[0]) )
fig, ax = plt.subplots(1,1)
fig.set_figwidth(10)
fig.set_figheight(6)
ax.grid(axis='x')
ax.set_xticks(np.arange(0,24))
ax.set_xticklabels(np.arange(0,24), rotation=45)
ax.hist(hours, bins=24)
ax.set_xlabel('hour of the day (0-23)')
ax.set_ylabel('freq')
ax.set_title('Histogram of commits by hour of the day')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment