def popular(tokens, optional=None): """ Displays the 10 most made recipes for the week to the user :param tokens: processed line of input :param optional: N/A :return: """ return RecipeListLoop(list(item[0] for item in Recipe.get_popular_recipes(MANAGER, 10)))
def top_10_recipes_graph(manager): pairs = Recipe.get_popular_recipes(manager, 5) X = [] Y = [] for rec, count in pairs: X.append("\n".join(wrap(rec.name, 15))) Y.append(count) fig1, ax1 = plt.subplots() ax1.set_title("Most Made Recipes this Week") ax1.bar(height=Y, x=X, width=0.4) plt.show()