test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
 
 _view
 
 _xlabelsize
 
 _xtitle
 
 _xtitleoffset
 
 _xtitlesize
 
 _ytitle
 
 _ytitleoffset
 
 _ytitlesize
 

Detailed Description

Class for creating and managing a frame for a plot from TGraph2D

Definition at line 782 of file plotting.py.

Constructor & Destructor Documentation

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

Definition at line 784 of file plotting.py.

785  def __init__(self, pad, bounds, histos, ratioOrig, ratioFactor):
786  self._pad = pad
787  if ratioOrig:
788  self._pad = pad.cd(1)
789 
790  # adjust margins because of not having the ratio, we want
791  # the same bottom margin, so some algebra gives this
792  (xlow, ylow, width, height) = (self._pad.GetXlowNDC(), self._pad.GetYlowNDC(), self._pad.GetWNDC(), self._pad.GetHNDC())
793  xup = xlow+width
794  yup = ylow+height
795 
796  bottomMargin = self._pad.GetBottomMargin()
797  bottomMarginNew = ROOT.gStyle.GetPadBottomMargin()
798 
799  ylowNew = yup - (1-bottomMargin)/(1-bottomMarginNew) * (yup-ylow)
800  topMarginNew = self._pad.GetTopMargin() * (yup-ylow)/(yup-ylowNew)
801 
802  self._pad.SetPad(xlow, ylowNew, xup, yup)
803  self._pad.SetTopMargin(topMarginNew)
804  self._pad.SetBottomMargin(bottomMarginNew)
806  self._view = ROOT.TView.CreateView()
807  self._view.SetRange(bounds[0], bounds[1], 0, bounds[2], bounds[3], 20) # 20 is from Harrison-Stetson, may need tuning?
808  self._view.Top()
809  self._view.ShowAxis()
811  self._xtitleoffset = 1.8
812  self._ytitleoffset = 2.3
814  self._firstHisto = histos[0]

Member Function Documentation

def plotting.FrameTGraph2D.adjustMarginLeft (   self,
  adjust 
)

Definition at line 827 of file plotting.py.

828  def adjustMarginLeft(self, adjust):
829  self._pad.SetLeftMargin(self._pad.GetLeftMargin()+adjust)
830  self._pad.cd()
def plotting.FrameTGraph2D.adjustMarginRight (   self,
  adjust 
)

Definition at line 831 of file plotting.py.

832  def adjustMarginRight(self, adjust):
833  self._pad.SetRightMargin(self._pad.GetRightMargin()+adjust)
834  self._pad.cd()
def plotting.FrameTGraph2D.redrawAxis (   self)

Definition at line 865 of file plotting.py.

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

866  def redrawAxis(self):
867  # Disabling and enabled the 3D rulers somehow magically moves the axes to their proper places
868  ROOT.TAxis3D.ToggleRulers()
869  ROOT.TAxis3D.ToggleRulers()
870  axis = ROOT.TAxis3D.GetPadAxis()
871  axis.SetLabelColor(ROOT.kBlack);
872  axis.SetAxisColor(ROOT.kBlack);
873 
874  axis.GetXaxis().SetTitleOffset(self._xtitleoffset)
875  axis.GetYaxis().SetTitleOffset(self._ytitleoffset)
876 
877  if hasattr(self, "_xtitle"):
878  axis.GetXaxis().SetTitle(self._xtitle)
879  if hasattr(self, "_xtitlesize"):
880  axis.GetXaxis().SetTitleSize(self._xtitlesize)
881  if hasattr(self, "_xlabelsize"):
882  axis.GetXaxis().SetLabelSize(self._labelsize)
883  if hasattr(self, "_ytitle"):
884  axis.GetYaxis().SetTitle(self._ytitle)
885  if hasattr(self, "_ytitlesize"):
886  axis.GetYaxis().SetTitleSize(self._ytitlesize)
887  if hasattr(self, "_ytitleoffset"):
888  axis.GetYaxis().SetTitleOffset(self._ytitleoffset)
def plotting.FrameTGraph2D.setGridx (   self,
  grid 
)

Definition at line 821 of file plotting.py.

822  def setGridx(self, grid):
823  pass
def plotting.FrameTGraph2D.setGridy (   self,
  grid 
)

Definition at line 824 of file plotting.py.

825  def setGridy(self, grid):
826  pass
def plotting.FrameTGraph2D.setLogx (   self,
  log 
)

Definition at line 815 of file plotting.py.

816  def setLogx(self, log):
817  pass
def plotting.FrameTGraph2D.setLogy (   self,
  log 
)

Definition at line 818 of file plotting.py.

819  def setLogy(self, log):
820  pass
def plotting.FrameTGraph2D.setTitle (   self,
  title 
)

Definition at line 835 of file plotting.py.

836  def setTitle(self, title):
837  pass
def plotting.FrameTGraph2D.setXLabelSize (   self,
  size 
)

Definition at line 847 of file plotting.py.

848  def setXLabelSize(self, size):
849  self._xlabelsize = size
def plotting.FrameTGraph2D.setXTitle (   self,
  title 
)

Definition at line 838 of file plotting.py.

839  def setXTitle(self, title):
840  self._xtitle = title
def plotting.FrameTGraph2D.setXTitleOffset (   self,
  size 
)

Definition at line 844 of file plotting.py.

References plotting.FrameTGraph2D._xtitleoffset.

845  def setXTitleOffset(self, size):
846  self._xtitleoffset = size
def plotting.FrameTGraph2D.setXTitleSize (   self,
  size 
)

Definition at line 841 of file plotting.py.

842  def setXTitleSize(self, size):
843  self._xtitlesize = size
def plotting.FrameTGraph2D.setYTitle (   self,
  title 
)

Definition at line 850 of file plotting.py.

851  def setYTitle(self, title):
852  self._ytitle = title
def plotting.FrameTGraph2D.setYTitleOffset (   self,
  offset 
)

Definition at line 856 of file plotting.py.

References plotting.FrameTGraph2D._ytitleoffset.

857  def setYTitleOffset(self, offset):
858  self._ytitleoffset = offset
def plotting.FrameTGraph2D.setYTitleSize (   self,
  size 
)

Definition at line 853 of file plotting.py.

854  def setYTitleSize(self, size):
855  self._ytitlesize = size
def plotting.FrameTGraph2D.setZTitle (   self,
  title 
)

Definition at line 859 of file plotting.py.

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

Definition at line 862 of file plotting.py.

863  def setZTitleOffset(self, offset):
864  self._firstHisto.GetZaxis().SetTitleOffset(offset)

Member Data Documentation

plotting.FrameTGraph2D._firstHisto
private

Definition at line 813 of file plotting.py.

plotting.FrameTGraph2D._pad
private

Definition at line 785 of file plotting.py.

plotting.FrameTGraph2D._view
private

Definition at line 805 of file plotting.py.

plotting.FrameTGraph2D._xlabelsize
private

Definition at line 848 of file plotting.py.

plotting.FrameTGraph2D._xtitle
private

Definition at line 839 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._xtitleoffset
private

Definition at line 810 of file plotting.py.

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

plotting.FrameTGraph2D._xtitlesize
private

Definition at line 842 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitle
private

Definition at line 851 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().

plotting.FrameTGraph2D._ytitleoffset
private

Definition at line 811 of file plotting.py.

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

plotting.FrameTGraph2D._ytitlesize
private

Definition at line 854 of file plotting.py.

Referenced by plotting.FrameTGraph2D.redrawAxis().