summaryrefslogtreecommitdiff
path: root/.local/bin/plot_commits
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/plot_commits')
-rwxr-xr-x.local/bin/plot_commits27
1 files changed, 27 insertions, 0 deletions
diff --git a/.local/bin/plot_commits b/.local/bin/plot_commits
new file mode 100755
index 0000000..4e4d161
--- /dev/null
+++ b/.local/bin/plot_commits
@@ -0,0 +1,27 @@
+#!/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()"