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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1433 of file plotting.py.

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

Member Function Documentation

◆ adjustMarginLeft()

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1471 of file plotting.py.

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

◆ adjustMarginRight()

def plotting.FrameTGraph2D.adjustMarginRight (   self,
  adjust 
)

Definition at line 1475 of file plotting.py.

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

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

◆ redrawAxis()

def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 1509 of file plotting.py.

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

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

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

◆ setGridy()

def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 1468 of file plotting.py.

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

◆ setLogx()

def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 1459 of file plotting.py.

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

◆ setLogy()

def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 1462 of file plotting.py.

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

◆ setTitle()

def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 1479 of file plotting.py.

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

◆ setXLabelSize()

def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 1491 of file plotting.py.

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

◆ setXTitle()

def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 1482 of file plotting.py.

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

◆ setXTitleOffset()

def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 1488 of file plotting.py.

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

References plotting.FrameTGraph2D._xtitleoffset.

◆ setXTitleSize()

def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 1485 of file plotting.py.

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

◆ setYTitle()

def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 1494 of file plotting.py.

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

◆ setYTitleOffset()

def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 1500 of file plotting.py.

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

References plotting.FrameTGraph2D._ytitleoffset.

◆ setYTitleSize()

def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 1497 of file plotting.py.

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

◆ setZTitle()

def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 1503 of file plotting.py.

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

References plotting.FrameTGraph2D._firstHisto.

◆ setZTitleOffset()

def plotting.FrameTGraph2D.setZTitleOffset (   self,
  offset 
)

Definition at line 1506 of file plotting.py.

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

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

◆ _xtitle

plotting.FrameTGraph2D._xtitle
private

Definition at line 1483 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _xtitleoffset

plotting.FrameTGraph2D._xtitleoffset
private

◆ _xtitlesize

plotting.FrameTGraph2D._xtitlesize
private

Definition at line 1486 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitle

plotting.FrameTGraph2D._ytitle
private

Definition at line 1495 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

◆ _ytitleoffset

plotting.FrameTGraph2D._ytitleoffset
private

◆ _ytitlesize

plotting.FrameTGraph2D._ytitlesize
private

Definition at line 1498 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

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