Esempio n. 1
0
 def populateAxes(self, ax, columns=3):
     """ Returns the legend as a matplotlib artist
     Arguments:
         - columns: the number of columns of feature / representation
           pairs
     """
     ax.set_xlim(0, 600)
     ax.set_ylim(-800, 50)
     result = []
     x = y = 0
     for track in self.policy()._makeTrackDefns():
         if track.tag is None or track.tag == "Graphs":
             continue
         ax.text(10, y * 30, track.tag)
         y -= 1
         for feature in track:
             seq = self._makeSampleSequence(feature)
             display = Display(
                 seq,
                 policy=self.policy,
                 min_feature_height=10,
                 show_code=False,
                 pad=0,
             )
             sample = display.makeArtist()
             #trans = sample.get_transform()
             #offset = Affine2D()
             #offset.translate(x*600+20 / columns, y*30)
             sample.translate(x * 600 / columns + 10, y * 30)
             ax.add_artist(sample)
             ax.text(x * 600 / columns + 90, y * 30, feature)
             x += 1
             if x % columns == 0:
                 x = 0
                 y -= 1
         if x:
             x = 0
             y -= 1
         ax.axhline((y + .7) * 30)
Esempio n. 2
0
 def populateAxes(self, ax, columns = 3):
     """ Returns the legend as a matplotlib artist
     Arguments:
         - columns: the number of columns of feature / representation
           pairs
     """
     ax.set_xlim(0, 600)
     ax.set_ylim(-800, 50)
     result = []
     x = y = 0
     for track in self.policy()._makeTrackDefns():
         if track.tag is None or track.tag=="Graphs":
             continue
         ax.text(10, y*30, track.tag)
         y -= 1
         for feature in track:
             seq = self._makeSampleSequence(feature)
             display = Display(seq,
                     policy = self.policy,
                     min_feature_height = 10,
                     show_code = False,
                     pad = 0,)
             sample = display.makeArtist()
             #trans = sample.get_transform()
             #offset = Affine2D()
             #offset.translate(x*600+20 / columns, y*30)
             sample.translate(x*600/columns+10, y*30)
             ax.add_artist(sample)
             ax.text(x*600/columns+90, y*30, feature)
             x += 1
             if x % columns == 0:
                 x = 0
                 y -= 1
         if x:
             x = 0
             y -= 1
         ax.axhline((y+.7)*30)