Exemplo n.º 1
0
 def test_overlay(self):
     from ROOT import TFrame
     plotter = Rplot(2, 2, 1200, 800)
     plotter.draw_hist(self.plots, 'hist')
     plotter.canvas.Update()
     for i, plot in enumerate(self.plots):
         pad = plotter.canvas.cd(i+1)
         primitives = [pl for pl in pad.GetListOfPrimitives()
                       if not isinstance(pl, TFrame)]
         self.assertEqual(len(plot), len(primitives))
Exemplo n.º 2
0
 def test_overlay(self):
     from ROOT import TFrame
     plotter = Rplot(2, 2, 1200, 800)
     plotter.draw_hist(self.plots, 'hist')
     plotter.canvas.Update()
     for i, plot in enumerate(self.plots):
         pad = plotter.canvas.cd(i + 1)
         primitives = [
             pl for pl in pad.GetListOfPrimitives()
             if not isinstance(pl, TFrame)
         ]
         self.assertEqual(len(plot), len(primitives))
Exemplo n.º 3
0
 def test_stack(self):
     from ROOT import TFrame
     # splicing overwrites ROOT objects in memory
     plots = self.plots[2:]
     plotter = Rplot(2, 1, 1200, 400)
     plotter.stack = True
     plotter.draw_hist(plots, 'hist')
     plotter.canvas.Update()
     for i, plot in enumerate(plots):
         pad = plotter.canvas.cd(i+1)
         primitives = [pl for pl in pad.GetListOfPrimitives()
                       if not isinstance(pl, TFrame)]
         self.assertEqual(len(plot), len(primitives))
         ref_counts = []
         for j, pl in enumerate(plot):
             count = pl.GetEntries()
             if j > 0:
                 count += ref_counts[-1]
             ref_counts.append(count)
         ref_counts.reverse()
         self.assertListEqual(ref_counts, [pl.GetEntries()
                                           for pl in primitives])
Exemplo n.º 4
0
 def test_stack(self):
     from ROOT import TFrame
     # splicing overwrites ROOT objects in memory
     plots = self.plots[2:]
     plotter = Rplot(2, 1, 1200, 400)
     plotter.stack = True
     plotter.draw_hist(plots, 'hist')
     plotter.canvas.Update()
     for i, plot in enumerate(plots):
         pad = plotter.canvas.cd(i + 1)
         primitives = [
             pl for pl in pad.GetListOfPrimitives()
             if not isinstance(pl, TFrame)
         ]
         self.assertEqual(len(plot), len(primitives))
         ref_counts = []
         for j, pl in enumerate(plot):
             count = pl.GetEntries()
             if j > 0:
                 count += ref_counts[-1]
             ref_counts.append(count)
         ref_counts.reverse()
         self.assertListEqual(ref_counts,
                              [pl.GetEntries() for pl in primitives])