]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/commitdiff
Plot x axis labels in local variable
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 10 Aug 2018 08:58:56 +0000 (08:58 +0000)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 10 Aug 2018 09:00:08 +0000 (11:00 +0200)
app.py

diff --git a/app.py b/app.py
index eb7136c1e4422212f758bae6c22eee4663275d7a..c87ffc9021525cd6755dce4545e1028523723f41 100644 (file)
--- a/app.py
+++ b/app.py
@@ -96,11 +96,13 @@ def coffee_graph_history():
         range(len(days), 0, -1)]]
     xdays[-1] = "TDY"
     xdays[-2] = "YDA"
-    plt.xticks(range(len(days)), xdays)
+    ax.set_xticks(range(len(days)))
+    ax.set_xticklabels(xdays)
     ax.bar(range(len(days)), counts)
     ax.set_title("Your week")
     fig.savefig(b, format="svg", bbox_inches="tight")
     b.seek(0)
+    plt.close(fig)
     return send_file(b, mimetype="image/svg+xml")
 
 @app.route("/coffee/add", methods=["POST"])