summaryrefslogtreecommitdiff
path: root/.local/bin/plot_commits
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2021-06-10 08:05:06 +0000
committer0scar <qgt268@alumni.ku.dk>2021-06-10 08:05:06 +0000
commit7ad685aa6bd77d76115132280ce323d7fc5aeeb0 (patch)
treec605992dfb5582a050b8847eb624fa84f1f97d91 /.local/bin/plot_commits
parent6e4a15d79352ca2707a3b0d81d158228a7d14704 (diff)
Add scripts
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()"