]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/commitdiff
Do not show zeros in the taste graph
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 10 Aug 2018 11:56:56 +0000 (13:56 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 10 Aug 2018 11:56:56 +0000 (13:56 +0200)
app.py

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