From 60907f107654ed32e719b14a0560b0136291425d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Tue, 9 May 2017 13:45:39 +0200 Subject: [PATCH] add pie plot using matplotlib for Python --- pieplot.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pieplot.py diff --git a/pieplot.py b/pieplot.py new file mode 100644 index 0000000..1761786 --- /dev/null +++ b/pieplot.py @@ -0,0 +1,17 @@ +import matplotlib as mpl +mpl.use('svg') +import matplotlib.pyplot as plt + +users = ['alexander','christoffermadsen','jmaa','jacob'] +numbers = {} +for user in users: + number = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1] + numbers[user] = number + +values = list(numbers.values()) +labels = list(numbers.keys()) + +fig1, ax1 = plt.subplots() +ax1.pie(values,labels=labels,autopct="%1.1f%%", shadow=True, startangle=90) +ax1.axis('equal') +plt.savefig("/home/christoffermadsen/public_html/img/dcavpie.svg", format="svg")