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

Constructor & Destructor Documentation

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

Definition at line 1430 of file plotting.py.

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

Member Function Documentation

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1468 of file plotting.py.

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

Definition at line 1472 of file plotting.py.

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

Definition at line 1506 of file plotting.py.

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

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

Definition at line 1462 of file plotting.py.

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

Definition at line 1465 of file plotting.py.

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

Definition at line 1456 of file plotting.py.

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

Definition at line 1459 of file plotting.py.

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

Definition at line 1476 of file plotting.py.

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

Definition at line 1488 of file plotting.py.

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

Definition at line 1479 of file plotting.py.

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

Definition at line 1485 of file plotting.py.

References plotting.FrameTGraph2D._xtitleoffset.

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

Definition at line 1482 of file plotting.py.

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

Definition at line 1491 of file plotting.py.

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

Definition at line 1497 of file plotting.py.

References plotting.FrameTGraph2D._ytitleoffset.

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

Definition at line 1494 of file plotting.py.

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

Definition at line 1500 of file plotting.py.

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

Definition at line 1503 of file plotting.py.

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

Member Data Documentation

plotting.FrameTGraph2D._firstHisto
private

Definition at line 1454 of file plotting.py.

plotting.FrameTGraph2D._pad
private

Definition at line 1431 of file plotting.py.

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 1489 of file plotting.py.

plotting.FrameTGraph2D._xtitle
private

Definition at line 1480 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

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

Definition at line 1483 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitle
private

Definition at line 1492 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

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

Definition at line 1495 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().