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 1433 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1435 of file plotting.py.

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

Member Function Documentation

◆ adjustMarginLeft()

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1473 of file plotting.py.

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

◆ adjustMarginRight()

def plotting.FrameTGraph2D.adjustMarginRight (   self,
  adjust 
)

Definition at line 1477 of file plotting.py.

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

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

◆ redrawAxis()

def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 1511 of file plotting.py.

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

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 1467 of file plotting.py.

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

◆ setGridy()

def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 1470 of file plotting.py.

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

◆ setLogx()

def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 1461 of file plotting.py.

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

◆ setLogy()

def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 1464 of file plotting.py.

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

◆ setTitle()

def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 1481 of file plotting.py.

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

◆ setXLabelSize()

def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 1493 of file plotting.py.

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

◆ setXTitle()

def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 1484 of file plotting.py.

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

◆ setXTitleOffset()

def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 1490 of file plotting.py.

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

References plotting.FrameTGraph2D._xtitleoffset.

◆ setXTitleSize()

def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 1487 of file plotting.py.

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

◆ setYTitle()

def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 1496 of file plotting.py.

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

◆ setYTitleOffset()

def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 1502 of file plotting.py.

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

References plotting.FrameTGraph2D._ytitleoffset.

◆ setYTitleSize()

def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 1499 of file plotting.py.

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

◆ setZTitle()

def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 1505 of file plotting.py.

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

References plotting.FrameTGraph2D._firstHisto.

◆ setZTitleOffset()

def plotting.FrameTGraph2D.setZTitleOffset (   self,
  offset 
)

Definition at line 1508 of file plotting.py.

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

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 1494 of file plotting.py.

◆ _xtitle

plotting.FrameTGraph2D._xtitle
private

Definition at line 1485 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _xtitleoffset

plotting.FrameTGraph2D._xtitleoffset
private

◆ _xtitlesize

plotting.FrameTGraph2D._xtitlesize
private

Definition at line 1488 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitle

plotting.FrameTGraph2D._ytitle
private

Definition at line 1497 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitleoffset

plotting.FrameTGraph2D._ytitleoffset
private

◆ _ytitlesize

plotting.FrameTGraph2D._ytitlesize
private

Definition at line 1500 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

hgcalPlots.adjustMarginRight
adjustMarginRight
Definition: hgcalPlots.py:1163
trackingPlots.adjustMarginLeft
adjustMarginLeft
Definition: trackingPlots.py:227
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40