CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, pad, bounds, histos, ratioOrig, ratioFactor)
 
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, size)
 
def setXTitleSize (self, size)
 
def setYTitle (self, title)
 
def setYTitleOffset (self, offset)
 
def setYTitleSize (self, size)
 
def setZTitle (self, title)
 
def setZTitleOffset (self, offset)
 

Private Attributes

 _firstHisto
 
 _pad
 
 _xlabelsize
 
 _xtitle
 
 _xtitleoffset
 
 _xtitlesize
 
 _ytitle
 
 _ytitleoffset
 
 _ytitlesize
 

Detailed Description

Class for creating and managing a frame for a plot from TGraph2D

Definition at line 1432 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.FrameTGraph2D.__init__ (   self,
  pad,
  bounds,
  histos,
  ratioOrig,
  ratioFactor 
)

Definition at line 1434 of file plotting.py.

1434  def __init__(self, pad, bounds, histos, ratioOrig, ratioFactor):
1435  self._pad = pad
1436  if ratioOrig:
1437  self._pad = pad.cd(1)
1438 
1439  # adjust margins because of not having the ratio, we want
1440  # the same bottom margin, so some algebra gives this
1441  (xlow, ylow, width, height) = (self._pad.GetXlowNDC(), self._pad.GetYlowNDC(), self._pad.GetWNDC(), self._pad.GetHNDC())
1442  xup = xlow+width
1443  yup = ylow+height
1444 
1445  bottomMargin = self._pad.GetBottomMargin()
1446  bottomMarginNew = ROOT.gStyle.GetPadBottomMargin()
1447 
1448  ylowNew = yup - (1-bottomMargin)/(1-bottomMarginNew) * (yup-ylow)
1449  topMarginNew = self._pad.GetTopMargin() * (yup-ylow)/(yup-ylowNew)
1450 
1451  self._pad.SetPad(xlow, ylowNew, xup, yup)
1452  self._pad.SetTopMargin(topMarginNew)
1453  self._pad.SetBottomMargin(bottomMarginNew)
1454 
1455  self._xtitleoffset = 1.8
1456  self._ytitleoffset = 2.3
1457 
1458  self._firstHisto = histos[0]
1459 

Member Function Documentation

◆ adjustMarginLeft()

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1472 of file plotting.py.

1472  def adjustMarginLeft(self, adjust):
1473  self._pad.SetLeftMargin(self._pad.GetLeftMargin()+adjust)
1474  self._pad.cd()
1475 

◆ adjustMarginRight()

def plotting.FrameTGraph2D.adjustMarginRight (   self,
  adjust 
)

Definition at line 1476 of file plotting.py.

1476  def adjustMarginRight(self, adjust):
1477  self._pad.SetRightMargin(self._pad.GetRightMargin()+adjust)
1478  self._pad.cd()
1479 

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

◆ redrawAxis()

def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 1510 of file plotting.py.

1510  def redrawAxis(self):
1511  # set top view
1512  epsilon = 1e-7
1513  self._pad.SetPhi(epsilon)
1514  self._pad.SetTheta(90+epsilon)
1515 
1516  self._firstHisto.GetXaxis().SetTitleOffset(self._xtitleoffset)
1517  self._firstHisto.GetYaxis().SetTitleOffset(self._ytitleoffset)
1518 
1519  if hasattr(self, "_xtitle"):
1520  self._firstHisto.GetXaxis().SetTitle(self._xtitle)
1521  if hasattr(self, "_xtitlesize"):
1522  self._firstHisto.GetXaxis().SetTitleSize(self._xtitlesize)
1523  if hasattr(self, "_xlabelsize"):
1524  self._firstHisto.GetXaxis().SetLabelSize(self._labelsize)
1525  if hasattr(self, "_ytitle"):
1526  self._firstHisto.GetYaxis().SetTitle(self._ytitle)
1527  if hasattr(self, "_ytitlesize"):
1528  self._firstHisto.GetYaxis().SetTitleSize(self._ytitlesize)
1529  if hasattr(self, "_ytitleoffset"):
1530  self._firstHisto.GetYaxis().SetTitleOffset(self._ytitleoffset)
1531 

References plotting.FrameTGraph2D._firstHisto, plotting.Frame._pad, plotting.FrameRatio._pad, plotting.FrameTGraph2D._pad, plotting.FrameTGraph2D._xtitle, plotting.FrameTGraph2D._xtitleoffset, plotting.FrameTGraph2D._xtitlesize, plotting.FrameTGraph2D._ytitle, plotting.FrameTGraph2D._ytitleoffset, and plotting.FrameTGraph2D._ytitlesize.

◆ setGridx()

def plotting.FrameTGraph2D.setGridx (   self,
  grid 
)

Definition at line 1466 of file plotting.py.

1466  def setGridx(self, grid):
1467  pass
1468 

◆ setGridy()

def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 1469 of file plotting.py.

1469  def setGridy(self, grid):
1470  pass
1471 

◆ setLogx()

def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 1460 of file plotting.py.

1460  def setLogx(self, log):
1461  pass
1462 

◆ setLogy()

def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 1463 of file plotting.py.

1463  def setLogy(self, log):
1464  pass
1465 

◆ setTitle()

def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 1480 of file plotting.py.

1480  def setTitle(self, title):
1481  pass
1482 

◆ setXLabelSize()

def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 1492 of file plotting.py.

1492  def setXLabelSize(self, size):
1493  self._xlabelsize = size
1494 

◆ setXTitle()

def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 1483 of file plotting.py.

1483  def setXTitle(self, title):
1484  self._xtitle = title
1485 

◆ setXTitleOffset()

def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 1489 of file plotting.py.

1489  def setXTitleOffset(self, size):
1490  self._xtitleoffset = size
1491 

References plotting.FrameTGraph2D._xtitleoffset.

◆ setXTitleSize()

def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 1486 of file plotting.py.

1486  def setXTitleSize(self, size):
1487  self._xtitlesize = size
1488 

◆ setYTitle()

def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 1495 of file plotting.py.

1495  def setYTitle(self, title):
1496  self._ytitle = title
1497 

◆ setYTitleOffset()

def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 1501 of file plotting.py.

1501  def setYTitleOffset(self, offset):
1502  self._ytitleoffset = offset
1503 

References plotting.FrameTGraph2D._ytitleoffset.

◆ setYTitleSize()

def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 1498 of file plotting.py.

1498  def setYTitleSize(self, size):
1499  self._ytitlesize = size
1500 

◆ setZTitle()

def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 1504 of file plotting.py.

1504  def setZTitle(self, title):
1505  self._firstHisto.GetZaxis().SetTitle(title)
1506 

References plotting.FrameTGraph2D._firstHisto.

◆ setZTitleOffset()

def plotting.FrameTGraph2D.setZTitleOffset (   self,
  offset 
)

Definition at line 1507 of file plotting.py.

1507  def setZTitleOffset(self, offset):
1508  self._firstHisto.GetZaxis().SetTitleOffset(offset)
1509 

References plotting.FrameTGraph2D._firstHisto.

Member Data Documentation

◆ _firstHisto

plotting.FrameTGraph2D._firstHisto
private

◆ _pad

plotting.FrameTGraph2D._pad
private

◆ _xlabelsize

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 1493 of file plotting.py.

◆ _xtitle

plotting.FrameTGraph2D._xtitle
private

Definition at line 1484 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _xtitleoffset

plotting.FrameTGraph2D._xtitleoffset
private

◆ _xtitlesize

plotting.FrameTGraph2D._xtitlesize
private

Definition at line 1487 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitle

plotting.FrameTGraph2D._ytitle
private

Definition at line 1496 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitleoffset

plotting.FrameTGraph2D._ytitleoffset
private

◆ _ytitlesize

plotting.FrameTGraph2D._ytitlesize
private

Definition at line 1499 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

hgcalPlots.adjustMarginRight
adjustMarginRight
Definition: hgcalPlots.py:1162
trackingPlots.adjustMarginLeft
adjustMarginLeft
Definition: trackingPlots.py:226
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40