#!/usr/bin/env bash set -e [ -n "${1}" ] && cd $1 REPOSITORY=$(basename $(git rev-parse --show-toplevel)) COMMITS=$(commits_by_hour -v \ | sed -E 's/^/[/;s/$/],/;s/ /,/;s/0([0-9]+)/\1/g' \ | tr -d '\n' \ | sed -E 's/^/x,y = zip(*[/;s/$/])/') python -c "from matplotlib import pyplot as plt;\ import numpy as np;\ $COMMITS;\ ymax=int(np.ceil(max(y) + (max(y)/10)));\ plt.grid(which='major',alpha=0.5,linestyle='--',axis='y');\ plt.bar(x,y,align='edge',width=1.0,color='#6fd0ff',edgecolor='#07a');\ plt.ylabel('Commits');\ plt.xlabel('Time');\ plt.title('Commits by the hour of the day, ${REPOSITORY}.git');\ plt.xlim(0,24);\ plt.ylim(0,ymax);\ plt.xticks(np.arange(0,24));\ plt.yticks(np.arange(0,ymax,max(1,int(np.ceil(ymax/15)))));\ plt.show()"