CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.Frame Class Reference

Public Member Functions

def __init__ (self, pad, bounds, zmax, nrows, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ybinlabels=None)
 
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, offset)
 
def setXTitleSize (self, size)
 
def setYTitle (self, title)
 
def setYTitleOffset (self, offset)
 
def setYTitleSize (self, size)
 

Private Attributes

 _frame
 
 _pad
 

Detailed Description

Class for creating and managing a frame for a simple, one-pad plot

Definition at line 1238 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.Frame.__init__ (   self,
  pad,
  bounds,
  zmax,
  nrows,
  xbinlabels = None,
  xbinlabelsize = None,
  xbinlabeloption = None,
  ybinlabels = None 
)

Definition at line 1240 of file plotting.py.

1240  def __init__(self, pad, bounds, zmax, nrows, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ybinlabels=None):
1241  self._pad = pad
1242  self._frame = _drawFrame(pad, bounds, zmax, xbinlabels, xbinlabelsize, xbinlabeloption, ybinlabels)
1243 
1244  yoffsetFactor = 1
1245  xoffsetFactor = 1
1246  if nrows == 2:
1247  yoffsetFactor *= 2
1248  xoffsetFactor *= 2
1249  elif nrows >= 5:
1250  yoffsetFactor *= 1.5
1251  xoffsetFactor *= 1.5
1252  elif nrows >= 3:
1253  yoffsetFactor *= 4
1254  xoffsetFactor *= 3
1255 
1256  self._frame.GetYaxis().SetTitleOffset(self._frame.GetYaxis().GetTitleOffset()*yoffsetFactor)
1257  self._frame.GetXaxis().SetTitleOffset(self._frame.GetXaxis().GetTitleOffset()*xoffsetFactor)
1258 
1259 

Member Function Documentation

◆ adjustMarginLeft()

def plotting.Frame.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1272 of file plotting.py.

1272  def adjustMarginLeft(self, adjust):
1273  self._pad.SetLeftMargin(self._pad.GetLeftMargin()+adjust)
1274  # Need to redraw frame after adjusting the margin
1275  self._pad.cd()
1276  self._frame.Draw("")
1277 

References plotting.Frame._frame, plotting.Frame._pad, and hippyaddtobaddatafiles.cd().

◆ adjustMarginRight()

def plotting.Frame.adjustMarginRight (   self,
  adjust 
)

Definition at line 1278 of file plotting.py.

1278  def adjustMarginRight(self, adjust):
1279  self._pad.SetRightMargin(self._pad.GetRightMargin()+adjust)
1280  # Need to redraw frame after adjusting the margin
1281  self._pad.cd()
1282  self._frame.Draw("")
1283 

References plotting.Frame._frame, plotting.Frame._pad, and hippyaddtobaddatafiles.cd().

◆ redrawAxis()

def plotting.Frame.redrawAxis (   self)

Definition at line 1308 of file plotting.py.

1308  def redrawAxis(self):
1309  self._pad.RedrawAxis()
1310 

References plotting.Frame._pad.

◆ setGridx()

def plotting.Frame.setGridx (   self,
  grid 
)

Definition at line 1266 of file plotting.py.

1266  def setGridx(self, grid):
1267  self._pad.SetGridx(grid)
1268 

References plotting.Frame._pad.

◆ setGridy()

def plotting.Frame.setGridy (   self,
  grid 
)

Definition at line 1269 of file plotting.py.

1269  def setGridy(self, grid):
1270  self._pad.SetGridy(grid)
1271 

References plotting.Frame._pad.

◆ setLogx()

def plotting.Frame.setLogx (   self,
  log 
)

Definition at line 1260 of file plotting.py.

1260  def setLogx(self, log):
1261  self._pad.SetLogx(log)
1262 

References plotting.Frame._pad.

◆ setLogy()

def plotting.Frame.setLogy (   self,
  log 
)

Definition at line 1263 of file plotting.py.

1263  def setLogy(self, log):
1264  self._pad.SetLogy(log)
1265 

References plotting.Frame._pad.

◆ setTitle()

def plotting.Frame.setTitle (   self,
  title 
)

Definition at line 1284 of file plotting.py.

1284  def setTitle(self, title):
1285  self._frame.SetTitle(title)
1286 

References plotting.Frame._frame.

◆ setXLabelSize()

def plotting.Frame.setXLabelSize (   self,
  size 
)

Definition at line 1296 of file plotting.py.

1296  def setXLabelSize(self, size):
1297  self._frame.GetXaxis().SetLabelSize(size)
1298 

References plotting.Frame._frame.

◆ setXTitle()

def plotting.Frame.setXTitle (   self,
  title 
)

Definition at line 1287 of file plotting.py.

1287  def setXTitle(self, title):
1288  self._frame.GetXaxis().SetTitle(title)
1289 

References plotting.Frame._frame.

◆ setXTitleOffset()

def plotting.Frame.setXTitleOffset (   self,
  offset 
)

Definition at line 1293 of file plotting.py.

1293  def setXTitleOffset(self, offset):
1294  self._frame.GetXaxis().SetTitleOffset(offset)
1295 

References plotting.Frame._frame.

◆ setXTitleSize()

def plotting.Frame.setXTitleSize (   self,
  size 
)

Definition at line 1290 of file plotting.py.

1290  def setXTitleSize(self, size):
1291  self._frame.GetXaxis().SetTitleSize(size)
1292 

References plotting.Frame._frame.

◆ setYTitle()

def plotting.Frame.setYTitle (   self,
  title 
)

Definition at line 1299 of file plotting.py.

1299  def setYTitle(self, title):
1300  self._frame.GetYaxis().SetTitle(title)
1301 

References plotting.Frame._frame.

◆ setYTitleOffset()

def plotting.Frame.setYTitleOffset (   self,
  offset 
)

Definition at line 1305 of file plotting.py.

1305  def setYTitleOffset(self, offset):
1306  self._frame.GetYaxis().SetTitleOffset(offset)
1307 

References plotting.Frame._frame.

◆ setYTitleSize()

def plotting.Frame.setYTitleSize (   self,
  size 
)

Definition at line 1302 of file plotting.py.

1302  def setYTitleSize(self, size):
1303  self._frame.GetYaxis().SetTitleSize(size)
1304 

References plotting.Frame._frame.

Member Data Documentation

◆ _frame

plotting.Frame._frame
private

◆ _pad

plotting.Frame._pad
private
plotting._drawFrame
def _drawFrame(pad, bounds, zmax=None, xbinlabels=None, xbinlabelsize=None, xbinlabeloption=None, ybinlabels=None, suffix="")
Definition: plotting.py:1186
hgcalPlots.adjustMarginRight
adjustMarginRight
Definition: hgcalPlots.py:1129
trackingPlots.adjustMarginLeft
adjustMarginLeft
Definition: trackingPlots.py:227
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40