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

Constructor & Destructor Documentation

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

Definition at line 1431 of file plotting.py.

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

Member Function Documentation

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1469 of file plotting.py.

1469  def adjustMarginLeft(self, adjust):
1470  self._pad.SetLeftMargin(self._pad.GetLeftMargin()+adjust)
1471  self._pad.cd()
1472 
def adjustMarginLeft(self, adjust)
Definition: plotting.py:1469
def plotting.FrameTGraph2D.adjustMarginRight (   self,
  adjust 
)

Definition at line 1473 of file plotting.py.

1473  def adjustMarginRight(self, adjust):
1474  self._pad.SetRightMargin(self._pad.GetRightMargin()+adjust)
1475  self._pad.cd()
1476 
def adjustMarginRight(self, adjust)
Definition: plotting.py:1473
def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 1507 of file plotting.py.

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

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

Definition at line 1463 of file plotting.py.

1463  def setGridx(self, grid):
1464  pass
1465 
def setGridx(self, grid)
Definition: plotting.py:1463
def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 1466 of file plotting.py.

1466  def setGridy(self, grid):
1467  pass
1468 
def setGridy(self, grid)
Definition: plotting.py:1466
def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 1457 of file plotting.py.

1457  def setLogx(self, log):
1458  pass
1459 
def setLogx(self, log)
Definition: plotting.py:1457
def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 1460 of file plotting.py.

1460  def setLogy(self, log):
1461  pass
1462 
def setLogy(self, log)
Definition: plotting.py:1460
def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 1477 of file plotting.py.

1477  def setTitle(self, title):
1478  pass
1479 
def setTitle(self, title)
Definition: plotting.py:1477
def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 1489 of file plotting.py.

1489  def setXLabelSize(self, size):
1490  self._xlabelsize = size
1491 
def setXLabelSize(self, size)
Definition: plotting.py:1489
def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 1480 of file plotting.py.

1480  def setXTitle(self, title):
1481  self._xtitle = title
1482 
def setXTitle(self, title)
Definition: plotting.py:1480
def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 1486 of file plotting.py.

References plotting.FrameTGraph2D._xtitleoffset.

1486  def setXTitleOffset(self, size):
1487  self._xtitleoffset = size
1488 
def setXTitleOffset(self, size)
Definition: plotting.py:1486
def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 1483 of file plotting.py.

1483  def setXTitleSize(self, size):
1484  self._xtitlesize = size
1485 
def setXTitleSize(self, size)
Definition: plotting.py:1483
def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 1492 of file plotting.py.

1492  def setYTitle(self, title):
1493  self._ytitle = title
1494 
def setYTitle(self, title)
Definition: plotting.py:1492
def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 1498 of file plotting.py.

References plotting.FrameTGraph2D._ytitleoffset.

1498  def setYTitleOffset(self, offset):
1499  self._ytitleoffset = offset
1500 
def setYTitleOffset(self, offset)
Definition: plotting.py:1498
def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 1495 of file plotting.py.

1495  def setYTitleSize(self, size):
1496  self._ytitlesize = size
1497 
def setYTitleSize(self, size)
Definition: plotting.py:1495
def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 1501 of file plotting.py.

1501  def setZTitle(self, title):
1502  self._firstHisto.GetZaxis().SetTitle(title)
1503 
def setZTitle(self, title)
Definition: plotting.py:1501
def plotting.FrameTGraph2D.setZTitleOffset (   self,
  offset 
)

Definition at line 1504 of file plotting.py.

1504  def setZTitleOffset(self, offset):
1505  self._firstHisto.GetZaxis().SetTitleOffset(offset)
1506 
def setZTitleOffset(self, offset)
Definition: plotting.py:1504

Member Data Documentation

plotting.FrameTGraph2D._firstHisto
private

Definition at line 1455 of file plotting.py.

plotting.FrameTGraph2D._pad
private

Definition at line 1432 of file plotting.py.

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 1490 of file plotting.py.

plotting.FrameTGraph2D._xtitle
private

Definition at line 1481 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._xtitleoffset
private
plotting.FrameTGraph2D._xtitlesize
private

Definition at line 1484 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitle
private

Definition at line 1493 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitleoffset
private
plotting.FrameTGraph2D._ytitlesize
private

Definition at line 1496 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().