From: Tomas Prochazka Date: Fri, 10 Aug 2018 11:40:29 +0000 (+0200) Subject: Showing the total number different coffee flavor in chart X-Git-Url: https://rtime.felk.cvut.cz/gitweb/coffee/coffee-flask.git/commitdiff_plain/f9d1adb7a4d9957f523692a5ae392b9f6c5b5b66?ds=sidebyside Showing the total number different coffee flavor in chart --- diff --git a/app.py b/app.py index 05a7dbc..94f438d 100644 --- 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)