CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.FrameRatio Class Reference

Public Member Functions

def __init__ (self, pad, bounds, zmax, ratioBounds, ratioFactor, nrows, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ratioYTitle=_ratioYTitle)
 
def adjustMarginLeft (self, adjust)
 
def adjustMarginRight (self, adjust)
 
def redrawAxis (self)
 
def setGridx (self, grid)
 
def setGridy (self, grid)
 
def setLogx (self, log)
 
def setLogy (self, log)
 
def setTitle (self, title)
 
def setXLabelSize (self, size)
 
def setXTitle (self, title)
 
def setXTitleOffset (self, offset)
 
def setXTitleSize (self, size)
 
def setYTitle (self, title)
 
def setYTitleOffset (self, offset)
 
def setYTitleRatio (self, title)
 
def setYTitleSize (self, size)
 

Private Attributes

 _coverPad
 
 _frame
 
 _frameRatio
 
 _pad
 
 _padRatio
 
 _parentPad
 

Detailed Description

Class for creating and managing a frame for a ratio plot with two subpads

Definition at line 1303 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.FrameRatio.__init__ (   self,
  pad,
  bounds,
  zmax,
  ratioBounds,
  ratioFactor,
  nrows,
  xbinlabels = None,
  xbinlabelsize = None,
  xbinlabeloption = None,
  ratioYTitle = _ratioYTitle 
)

Definition at line 1305 of file plotting.py.

1305  def __init__(self, pad, bounds, zmax, ratioBounds, ratioFactor, nrows, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ratioYTitle=_ratioYTitle):
1306  self._parentPad = pad
1307  self._pad = pad.cd(1)
1308  if xbinlabels is not None:
1309  self._frame = _drawFrame(self._pad, bounds, zmax, [""]*len(xbinlabels))
1310  else:
1311  self._frame = _drawFrame(self._pad, bounds, zmax)
1312  self._padRatio = pad.cd(2)
1313  self._frameRatio = _drawFrame(self._padRatio, ratioBounds, zmax, xbinlabels, xbinlabelsize, xbinlabeloption)
1314 
1315  self._frame.GetXaxis().SetLabelSize(0)
1316  self._frame.GetXaxis().SetTitleSize(0)
1317 
1318  yoffsetFactor = ratioFactor
1319  xoffsetFactor = 0
1320 
1321  self._frame.GetYaxis().SetTitleOffset(self._frameRatio.GetYaxis().GetTitleOffset()*yoffsetFactor)
1322  self._frameRatio.GetYaxis().SetLabelSize(int(self._frameRatio.GetYaxis().GetLabelSize()*0.8))
1323  self._frameRatio.GetYaxis().SetTitleOffset(self._frameRatio.GetYaxis().GetTitleOffset()*yoffsetFactor)
1324  self._frameRatio.GetXaxis().SetTitleOffset(self._frameRatio.GetXaxis().GetTitleOffset()*xoffsetFactor)
1325 
1326  self._frameRatio.GetYaxis().SetNdivisions(4, 5, 0)
1327 
1328  self._frameRatio.GetYaxis().SetTitle(ratioYTitle)
1329 
def _drawFrame(pad, bounds, zmax=None, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ybinlabels=None, suffix="")
Definition: plotting.py:1187
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ adjustMarginLeft()

def plotting.FrameRatio.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1345 of file plotting.py.

References plotting.Frame._frame, plotting.FrameRatio._frame, plotting.FrameRatio._frameRatio, plotting.Frame._pad, plotting.FrameRatio._pad, plotting.FrameRatio._padRatio, and hippyaddtobaddatafiles.cd().

1345  def adjustMarginLeft(self, adjust):
1346  self._pad.SetLeftMargin(self._pad.GetLeftMargin()+adjust)
1347  self._padRatio.SetLeftMargin(self._padRatio.GetLeftMargin()+adjust)
1348  # Need to redraw frame after adjusting the margin
1349  self._pad.cd()
1350  self._frame.Draw("")
1351  self._padRatio.cd()
1352  self._frameRatio.Draw("")
1353 

◆ adjustMarginRight()

def plotting.FrameRatio.adjustMarginRight (   self,
  adjust 
)

Definition at line 1354 of file plotting.py.

References plotting.Frame._frame, plotting.FrameRatio._frame, plotting.FrameRatio._frameRatio, plotting.Frame._pad, plotting.FrameRatio._pad, plotting.FrameRatio._padRatio, and hippyaddtobaddatafiles.cd().

1354  def adjustMarginRight(self, adjust):
1355  self._pad.SetRightMargin(self._pad.GetRightMargin()+adjust)
1356  self._padRatio.SetRightMargin(self._padRatio.GetRightMargin()+adjust)
1357  # Need to redraw frames after adjusting the margin
1358  self._pad.cd()
1359  self._frame.Draw("")
1360  self._padRatio.cd()
1361  self._frameRatio.Draw("")
1362 

◆ redrawAxis()

def plotting.FrameRatio.redrawAxis (   self)

Definition at line 1392 of file plotting.py.

References plotting.Frame._pad, plotting.FrameRatio._pad, plotting.FrameRatio._padRatio, plotting.FrameRatio._parentPad, and hippyaddtobaddatafiles.cd().

1392  def redrawAxis(self):
1393  self._padRatio.RedrawAxis()
1394  self._pad.RedrawAxis()
1395 
1396  self._parentPad.cd()
1397 
1398  # pad to hide the lowest y axis label of the main pad
1399  xmin=0.065
1400  ymin=0.285
1401  xmax=0.128
1402  ymax=0.33
1403  self._coverPad = ROOT.TPad("coverpad", "coverpad", xmin, ymin, xmax, ymax)
1404  self._coverPad.SetBorderMode(0)
1405  self._coverPad.Draw()
1406 
1407  self._pad.cd()
1408  self._pad.Pop() # Move the first pad on top
1409 

◆ setGridx()

def plotting.FrameRatio.setGridx (   self,
  grid 
)

Definition at line 1337 of file plotting.py.

References plotting.Frame._pad, plotting.FrameRatio._pad, and plotting.FrameRatio._padRatio.

1337  def setGridx(self, grid):
1338  self._pad.SetGridx(grid)
1339  self._padRatio.SetGridx(grid)
1340 

◆ setGridy()

def plotting.FrameRatio.setGridy (   self,
  grid 
)

Definition at line 1341 of file plotting.py.

References plotting.Frame._pad, plotting.FrameRatio._pad, and plotting.FrameRatio._padRatio.

1341  def setGridy(self, grid):
1342  self._pad.SetGridy(grid)
1343  self._padRatio.SetGridy(grid)
1344 

◆ setLogx()

def plotting.FrameRatio.setLogx (   self,
  log 
)

Definition at line 1330 of file plotting.py.

References plotting.Frame._pad, plotting.FrameRatio._pad, and plotting.FrameRatio._padRatio.

1330  def setLogx(self, log):
1331  self._pad.SetLogx(log)
1332  self._padRatio.SetLogx(log)
1333 

◆ setLogy()

def plotting.FrameRatio.setLogy (   self,
  log 
)

Definition at line 1334 of file plotting.py.

References plotting.Frame._pad, and plotting.FrameRatio._pad.

1334  def setLogy(self, log):
1335  self._pad.SetLogy(log)
1336 

◆ setTitle()

def plotting.FrameRatio.setTitle (   self,
  title 
)

Definition at line 1363 of file plotting.py.

References plotting.Frame._frame, and plotting.FrameRatio._frame.

1363  def setTitle(self, title):
1364  self._frame.SetTitle(title)
1365 

◆ setXLabelSize()

def plotting.FrameRatio.setXLabelSize (   self,
  size 
)

Definition at line 1375 of file plotting.py.

References plotting.FrameRatio._frameRatio.

1375  def setXLabelSize(self, size):
1376  self._frameRatio.GetXaxis().SetLabelSize(size)
1377 

◆ setXTitle()

def plotting.FrameRatio.setXTitle (   self,
  title 
)

Definition at line 1366 of file plotting.py.

References plotting.FrameRatio._frameRatio.

1366  def setXTitle(self, title):
1367  self._frameRatio.GetXaxis().SetTitle(title)
1368 

◆ setXTitleOffset()

def plotting.FrameRatio.setXTitleOffset (   self,
  offset 
)

Definition at line 1372 of file plotting.py.

References plotting.FrameRatio._frameRatio.

1372  def setXTitleOffset(self, offset):
1373  self._frameRatio.GetXaxis().SetTitleOffset(offset)
1374 

◆ setXTitleSize()

def plotting.FrameRatio.setXTitleSize (   self,
  size 
)

Definition at line 1369 of file plotting.py.

References plotting.FrameRatio._frameRatio.

1369  def setXTitleSize(self, size):
1370  self._frameRatio.GetXaxis().SetTitleSize(size)
1371 

◆ setYTitle()

def plotting.FrameRatio.setYTitle (   self,
  title 
)

Definition at line 1378 of file plotting.py.

References plotting.Frame._frame, and plotting.FrameRatio._frame.

1378  def setYTitle(self, title):
1379  self._frame.GetYaxis().SetTitle(title)
1380 

◆ setYTitleOffset()

def plotting.FrameRatio.setYTitleOffset (   self,
  offset 
)

Definition at line 1388 of file plotting.py.

References plotting.Frame._frame, plotting.FrameRatio._frame, and plotting.FrameRatio._frameRatio.

1388  def setYTitleOffset(self, offset):
1389  self._frame.GetYaxis().SetTitleOffset(offset)
1390  self._frameRatio.GetYaxis().SetTitleOffset(offset)
1391 

◆ setYTitleRatio()

def plotting.FrameRatio.setYTitleRatio (   self,
  title 
)

Definition at line 1381 of file plotting.py.

References plotting.FrameRatio._frameRatio.

1381  def setYTitleRatio(self, title):
1382  self._frameRatio.GetYaxis().SetTitle(title)
1383 

◆ setYTitleSize()

def plotting.FrameRatio.setYTitleSize (   self,
  size 
)

Definition at line 1384 of file plotting.py.

References plotting.Frame._frame, plotting.FrameRatio._frame, and plotting.FrameRatio._frameRatio.

1384  def setYTitleSize(self, size):
1385  self._frame.GetYaxis().SetTitleSize(size)
1386  self._frameRatio.GetYaxis().SetTitleSize(size)
1387 

Member Data Documentation

◆ _coverPad

plotting.FrameRatio._coverPad
private

Definition at line 1403 of file plotting.py.

◆ _frame

plotting.FrameRatio._frame
private

◆ _frameRatio

plotting.FrameRatio._frameRatio
private

◆ _pad

plotting.FrameRatio._pad
private

◆ _padRatio

plotting.FrameRatio._padRatio
private

◆ _parentPad

plotting.FrameRatio._parentPad
private

Definition at line 1306 of file plotting.py.

Referenced by plotting.FrameRatio.redrawAxis().