dcav-stats/pieplot.py

22 lines
793 B
Python
Raw Permalink Normal View History

2017-10-13 16:51:34 +00:00
import json
import matplotlib as mpl
mpl.use('svg')
import matplotlib.pyplot as plt
users = ['alexander','christoffermadsen','jmaa','jacob']
2017-10-13 16:51:34 +00:00
shot_counts = {}
shot_bandwidth = json.loads(open("log/bandwidth.dat", "r").read())
2017-10-13 16:51:34 +00:00
for user in users:
shot_counts[user] = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
fig1, ax1 = plt.subplots()
2017-10-13 16:51:34 +00:00
ax1.pie(list(shot_counts.values()),labels=list(shot_counts.keys()),autopct="%1.1f%%", shadow=True, startangle=90)
ax1.axis('equal')
plt.savefig("/home/christoffermadsen/public_html/img/dcavpie.svg", format="svg")
2017-10-13 16:51:34 +00:00
#fig2, ax2 = plt.subplots()
#plt.figure(fig2.number)
#plt.bar(list(shot_bandwidth.keys()), list(shot_bandwidth.values()))
#plt.savefig("/home/christoffermadsen/public_html/img/dcavbandwidth.svg", format="svg")