]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/commitdiff
Showing the total number different coffee flavor in chart
authorTomas Prochazka <tomas.prochazka@cvut.cz>
Fri, 10 Aug 2018 11:40:29 +0000 (13:40 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 10 Aug 2018 11:47:57 +0000 (13:47 +0200)
app.py

diff --git a/app.py b/app.py
index 05a7dbcaaa803043e1fb6251039e5a438e1110ef..94f438dce790967017fe3d19173abc1061f383c6 100644 (file)
--- a/app.py
+++ b/app.py
@@ -76,8 +76,8 @@ def coffee_graph_flavors():
     fig = plt.figure(figsize=(3, 3))
     ax = fig.add_subplot(111)
     ax.set_aspect(1)
-    ax.pie(counts)
-    ax.legend(flavors)
+    ax.pie(counts,autopct=lambda p : '{:.0f}'.format(p * sum(counts)/100))
+    ax.legend(flavors,bbox_to_anchor=(1.0, 1.0))
     ax.set_title("Your taste")
     fig.savefig(b, format="svg", bbox_inches="tight")
     b.seek(0)