Add simple matplotlib bar plots per run

This commit is contained in:
LSaldyt
2017-09-26 21:16:20 -06:00
parent bc848e8f2d
commit 4348554fa7
4 changed files with 54225 additions and 1 deletions

View File

@ -1 +1,2 @@
from .copycat import Copycat, Reporter # noqa
from .plot import plot_answers

18
copycat/plot.py Normal file
View File

@ -0,0 +1,18 @@
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
def plot_answers(answers):
answers = sorted(answers.items(), key=lambda kv : kv[1]['count'])
objects = [t[0] + ' (temp:{})'.format(t[1]['avgtemp']) for t in answers]
yvalues = [t[1]['count'] for t in answers]
y_pos = np.arange(len(objects))
plt.bar(y_pos, yvalues, align='center', alpha=0.5)
plt.xticks(y_pos, objects)
plt.ylabel('Count')
plt.title('Answers')
plt.show()