def addLegend (self, pairs):
        if len (pairs) == 0:
            return
        """self.leg = Legend (width = self.settings.width, textHeight = self.settings.legendTextHeight)
        keys = pairs.keys ()
        keys.sort ()
        for k in keys:
            self.leg.addKey (k, pairs[k])
        self.leg.y = self.settings.height - self.leg.height
        self.canvas.move (0, self.leg.height + 20)
        self.canvas.changeSize (0, -(self.leg.height + 20))
        self.draw (self.leg)"""
        self.leg = Legend (width = self.settings.width / 4.0, textHeight = self.settings.legendTextHeight)
        keys = pairs.keys ()
        keys.sort ()
        for k in keys:
            self.leg.addKey (k, pairs[k])
        self.canvas.changeSize (-self.leg.width, 0)
        self.leg.y = self.settings.height - (self.canvas.height + self.canvas.y)
        self.leg.x = self.canvas.x + self.canvas.width
        #self.leg.y = self.settings.height - self.leg.height
        #self.canvas.move (0, self.leg.height + 20)
        self.draw (self.leg)
dataset/ETHPy150Open dotskapes/dotSkapes/modules/savage/graph/base.py/BaseGraph.addLegend/original