diff options
author | jwanek <eddie.atten.ea29@gmail.com> | 2020-03-30 20:18:25 +0100 |
---|---|---|
committer | jwanek <eddie.atten.ea29@gmail.com> | 2020-03-30 20:18:25 +0100 |
commit | b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f (patch) | |
tree | 1e900d65d4ea462b89ae9b4469b7bbe15df70220 /graph.py | |
parent | a6053befbb0b2d61e3aa53058e1f27832b0753b6 (diff) | |
parent | 4a9f566d2d45c7634a4b4ee4ccde7a1a4afe528b (diff) | |
download | SmallYTChannelBot-b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f.tar.gz SmallYTChannelBot-b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f.zip |
Started major refactoring, see README.md
Diffstat (limited to 'graph.py')
-rwxr-xr-x | graph.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/graph.py b/graph.py new file mode 100755 index 0000000..723997b --- /dev/null +++ b/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 |