CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
plotting.FrameTGraph2D Class Reference

Public Member Functions

def __init__
 
def adjustMarginLeft
 
def adjustMarginRight
 
def redrawAxis
 
def setGridx
 
def setGridy
 
def setLogx
 
def setLogy
 
def setTitle
 
def setXLabelSize
 
def setXTitle
 
def setXTitleOffset
 
def setXTitleSize
 
def setYTitle
 
def setYTitleOffset
 
def setYTitleSize
 
def setZTitle
 
def setZTitleOffset
 

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

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

Definition at line 1434 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)
1456  self._xtitleoffset = 1.8
1457  self._ytitleoffset = 2.3
1459  self._firstHisto = histos[0]

Member Function Documentation

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1472 of file plotting.py.

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

Definition at line 1476 of file plotting.py.

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

Definition at line 1510 of file plotting.py.

References plotting.FrameTGraph2D._xtitle, plotting.FrameTGraph2D._xtitleoffset, plotting.FrameTGraph2D._xtitlesize, plotting.FrameTGraph2D._ytitle, plotting.FrameTGraph2D._ytitleoffset, and plotting.FrameTGraph2D._ytitlesize.

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)
def plotting.FrameTGraph2D.setGridx (   self,
  grid 
)

Definition at line 1466 of file plotting.py.

1467  def setGridx(self, grid):
1468  pass
def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 1469 of file plotting.py.

1470  def setGridy(self, grid):
1471  pass
def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 1460 of file plotting.py.

1461  def setLogx(self, log):
1462  pass
def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 1463 of file plotting.py.

1464  def setLogy(self, log):
1465  pass
def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 1480 of file plotting.py.

1481  def setTitle(self, title):
1482  pass
def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 1492 of file plotting.py.

1493  def setXLabelSize(self, size):
1494  self._xlabelsize = size
def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 1483 of file plotting.py.

1484  def setXTitle(self, title):
1485  self._xtitle = title
def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 1489 of file plotting.py.

References plotting.FrameTGraph2D._xtitleoffset.

1490  def setXTitleOffset(self, size):
1491  self._xtitleoffset = size
def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 1486 of file plotting.py.

1487  def setXTitleSize(self, size):
1488  self._xtitlesize = size
def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 1495 of file plotting.py.

1496  def setYTitle(self, title):
1497  self._ytitle = title
def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 1501 of file plotting.py.

References plotting.FrameTGraph2D._ytitleoffset.

1502  def setYTitleOffset(self, offset):
1503  self._ytitleoffset = offset
def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 1498 of file plotting.py.

1499  def setYTitleSize(self, size):
1500  self._ytitlesize = size
def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 1504 of file plotting.py.

1505  def setZTitle(self, title):
1506  self._firstHisto.GetZaxis().SetTitle(title)
def plotting.FrameTGraph2D.setZTitleOffset (   self,
  offset 
)

Definition at line 1507 of file plotting.py.

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

Member Data Documentation

plotting.FrameTGraph2D._firstHisto
private

Definition at line 1458 of file plotting.py.

plotting.FrameTGraph2D._pad
private

Definition at line 1435 of file plotting.py.

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 1493 of file plotting.py.

plotting.FrameTGraph2D._xtitle
private

Definition at line 1484 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._xtitleoffset
private

Definition at line 1455 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis(), and plotting.FrameTGraph2D.setXTitleOffset().

plotting.FrameTGraph2D._xtitlesize
private

Definition at line 1487 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitle
private

Definition at line 1496 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitleoffset
private

Definition at line 1456 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis(), and plotting.FrameTGraph2D.setYTitleOffset().

plotting.FrameTGraph2D._ytitlesize
private

Definition at line 1499 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().