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

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 
def __init__(self, pad, bounds, histos, ratioOrig, ratioFactor)
Definition: plotting.py:1433

Member Function Documentation

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 
def adjustMarginLeft(self, adjust)
Definition: plotting.py:1471
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 
def adjustMarginRight(self, adjust)
Definition: plotting.py:1475
def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 1509 of file plotting.py.

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

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

Definition at line 1465 of file plotting.py.

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

Definition at line 1468 of file plotting.py.

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

Definition at line 1459 of file plotting.py.

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

Definition at line 1462 of file plotting.py.

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

Definition at line 1479 of file plotting.py.

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

Definition at line 1491 of file plotting.py.

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

Definition at line 1482 of file plotting.py.

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

Definition at line 1488 of file plotting.py.

References plotting.FrameTGraph2D._xtitleoffset.

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

Definition at line 1485 of file plotting.py.

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

Definition at line 1494 of file plotting.py.

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

Definition at line 1500 of file plotting.py.

References plotting.FrameTGraph2D._ytitleoffset.

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

Definition at line 1497 of file plotting.py.

1497  def setYTitleSize(self, size):
1498  self._ytitlesize = size
1499 
def setYTitleSize(self, size)
Definition: plotting.py:1497
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 
def setZTitle(self, title)
Definition: plotting.py:1503
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 
def setZTitleOffset(self, offset)
Definition: plotting.py:1506

Member Data Documentation

plotting.FrameTGraph2D._firstHisto
private

Definition at line 1457 of file plotting.py.

plotting.FrameTGraph2D._pad
private

Definition at line 1434 of file plotting.py.

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 1492 of file plotting.py.

plotting.FrameTGraph2D._xtitle
private

Definition at line 1483 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

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

Definition at line 1486 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitle
private

Definition at line 1495 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

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

Definition at line 1498 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().