diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-04-19 21:54:00 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-04-19 21:54:00 +0100 |
commit | 171daf88a753d5683dda695ff83013ae90a76809 (patch) | |
tree | 00fb9c7aafe4cd708b4ad27937663ac4c12620df /onceaday | |
parent | 6f29d39a9727688f7f4b25670614abbe66baa957 (diff) | |
download | SmallYTChannelBot-171daf88a753d5683dda695ff83013ae90a76809.tar.gz SmallYTChannelBot-171daf88a753d5683dda695ff83013ae90a76809.zip |
fixed some bugs
Diffstat (limited to 'onceaday')
-rwxr-xr-x | onceaday/graph.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/onceaday/graph.py b/onceaday/graph.py new file mode 100755 index 0000000..723997b --- /dev/null +++ b/onceaday/graph.py @@ -0,0 +1,31 @@ +from mpl_toolkits.axes_grid1 import host_subplot +import mpl_toolkits.axisartist as AA +import matplotlib.pyplot as plt +import matplotlib +import datetime + +def make_graph(data): + fig = plt.figure() + + lambdaCount = [i[1] for i in data] + helpGiven = [i[2] for i in data] + uniqueUsers = [i[3] for i in data] + date = [datetime.datetime.strptime(i[4], "%Y-%m-%d") for i in data] + + fig, ax1 = plt.subplots() + ax1.plot(date, lambdaCount, label = "Total λ in circulation", color = "r") + ax1.set_ylabel("Total λ / help given") + + ax1.plot(date, helpGiven, label = "Times help given", color = "g") + + ax2 = ax1.twinx() + ax2.plot(date, uniqueUsers, label = "Unique users") + ax2.set_ylabel("No. Unique Users") + + ax1.legend() + ax2.legend(loc = 4) + fig.autofmt_xdate() + + filepath = "graph.png" + fig.savefig(filepath) + return filepath
\ No newline at end of file |