From ec401210fdbbaa6953d80fa41ab7c6e126d87f61 Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Sat, 13 Dec 2008 18:39:36 +0100 Subject: [PATCH] added a legend to the reviews graph. --- anki/graphs.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/anki/graphs.py b/anki/graphs.py index b3b16bd03..83b535213 100644 --- a/anki/graphs.py +++ b/anki/graphs.py @@ -133,8 +133,20 @@ from stats""") args = sum((self.unzip(self.stats[type].items(), limit=days, reverseLimit=True) for type in ["dayRepsMature", "dayRepsYoung", "dayRepsNew"]), []) self.filledGraph(graph, days, ["#7777ff", "#77ffff", "#ff7777"], *args) + + cheat = fig.add_subplot(111) + b1 = cheat.bar(-3, 0, color = "#ff7777") + b2 = cheat.bar(-4, 0, color = "#77ffff") + b3 = cheat.bar(-5, 0, color = "#7777ff") + + cheat.legend([b1, b2, b3], [ + _("New"), + _("Young"), + _("Mature")], loc='upper left') + graph.set_xlim(xmin=-days, xmax=0) graph.set_ylim(ymax=max(max(a for a in args[1::2])) + 10) + return fig def cumulativeDue(self, days=30):