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

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

Member Function Documentation

◆ adjustMarginLeft()

def plotting.Frame.adjustMarginLeft (   self,
  adjust 
)

Definition at line 1274 of file plotting.py.

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

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

◆ adjustMarginRight()

def plotting.Frame.adjustMarginRight (   self,
  adjust 
)

Definition at line 1280 of file plotting.py.

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

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

◆ redrawAxis()

def plotting.Frame.redrawAxis (   self)

Definition at line 1310 of file plotting.py.

1310  def redrawAxis(self):
1311  self._pad.RedrawAxis()
1312 

References plotting.Frame._pad.

◆ setGridx()

def plotting.Frame.setGridx (   self,
  grid 
)

Definition at line 1268 of file plotting.py.

1268  def setGridx(self, grid):
1269  self._pad.SetGridx(grid)
1270 

References plotting.Frame._pad.

◆ setGridy()

def plotting.Frame.setGridy (   self,
  grid 
)

Definition at line 1271 of file plotting.py.

1271  def setGridy(self, grid):
1272  self._pad.SetGridy(grid)
1273 

References plotting.Frame._pad.

◆ setLogx()

def plotting.Frame.setLogx (   self,
  log 
)

Definition at line 1262 of file plotting.py.

1262  def setLogx(self, log):
1263  self._pad.SetLogx(log)
1264 

References plotting.Frame._pad.

◆ setLogy()

def plotting.Frame.setLogy (   self,
  log 
)

Definition at line 1265 of file plotting.py.

1265  def setLogy(self, log):
1266  self._pad.SetLogy(log)
1267 

References plotting.Frame._pad.

◆ setTitle()

def plotting.Frame.setTitle (   self,
  title 
)

Definition at line 1286 of file plotting.py.

1286  def setTitle(self, title):
1287  self._frame.SetTitle(title)
1288 

References plotting.Frame._frame.

◆ setXLabelSize()

def plotting.Frame.setXLabelSize (   self,
  size 
)

Definition at line 1298 of file plotting.py.

1298  def setXLabelSize(self, size):
1299  self._frame.GetXaxis().SetLabelSize(size)
1300 

References plotting.Frame._frame.

◆ setXTitle()

def plotting.Frame.setXTitle (   self,
  title 
)

Definition at line 1289 of file plotting.py.

1289  def setXTitle(self, title):
1290  self._frame.GetXaxis().SetTitle(title)
1291 

References plotting.Frame._frame.

◆ setXTitleOffset()

def plotting.Frame.setXTitleOffset (   self,
  offset 
)

Definition at line 1295 of file plotting.py.

1295  def setXTitleOffset(self, offset):
1296  self._frame.GetXaxis().SetTitleOffset(offset)
1297 

References plotting.Frame._frame.

◆ setXTitleSize()

def plotting.Frame.setXTitleSize (   self,
  size 
)

Definition at line 1292 of file plotting.py.

1292  def setXTitleSize(self, size):
1293  self._frame.GetXaxis().SetTitleSize(size)
1294 

References plotting.Frame._frame.

◆ setYTitle()

def plotting.Frame.setYTitle (   self,
  title 
)

Definition at line 1301 of file plotting.py.

1301  def setYTitle(self, title):
1302  self._frame.GetYaxis().SetTitle(title)
1303 

References plotting.Frame._frame.

◆ setYTitleOffset()

def plotting.Frame.setYTitleOffset (   self,
  offset 
)

Definition at line 1307 of file plotting.py.

1307  def setYTitleOffset(self, offset):
1308  self._frame.GetYaxis().SetTitleOffset(offset)
1309 

References plotting.Frame._frame.

◆ setYTitleSize()

def plotting.Frame.setYTitleSize (   self,
  size 
)

Definition at line 1304 of file plotting.py.

1304  def setYTitleSize(self, size):
1305  self._frame.GetYaxis().SetTitleSize(size)
1306 

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:1188
hgcalPlots.adjustMarginRight
adjustMarginRight
Definition: hgcalPlots.py:1163
trackingPlots.adjustMarginLeft
adjustMarginLeft
Definition: trackingPlots.py:227
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40