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.PlotText Class Reference

Public Member Functions

def __init__
 
def Draw
 

Private Attributes

 _l
 
 _text
 
 _x
 
 _y
 

Detailed Description

Abstraction on top of TLatex

Definition at line 1333 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotText.__init__ (   self,
  x,
  y,
  text,
  size = None,
  bold = True,
  align = "left",
  color = ROOT.kBlack,
  font = None 
)
Constructor.

Arguments:
x     -- X coordinate of the text (in NDC)
y     -- Y coordinate of the text (in NDC)
text  -- String to draw
size  -- Size of text (None for the default value, taken from gStyle)
bold  -- Should the text be bold?
align -- Alignment of text (left, center, right)
color -- Color of the text
font  -- Specify font explicitly

Definition at line 1335 of file plotting.py.

1336  def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1337  """Constructor.
1338 
1339  Arguments:
1340  x -- X coordinate of the text (in NDC)
1341  y -- Y coordinate of the text (in NDC)
1342  text -- String to draw
1343  size -- Size of text (None for the default value, taken from gStyle)
1344  bold -- Should the text be bold?
1345  align -- Alignment of text (left, center, right)
1346  color -- Color of the text
1347  font -- Specify font explicitly
1348  """
1349  self._x = x
1350  self._y = y
1351  self._text = text
1353  self._l = ROOT.TLatex()
1354  self._l.SetNDC()
1355  if not bold:
1356  self._l.SetTextFont(self._l.GetTextFont()-20) # bold -> normal
1357  if font is not None:
1358  self._l.SetTextFont(font)
1359  if size is not None:
1360  self._l.SetTextSize(size)
1361  if isinstance(align, basestring):
1362  if align.lower() == "left":
1363  self._l.SetTextAlign(11)
1364  elif align.lower() == "center":
1365  self._l.SetTextAlign(21)
1366  elif align.lower() == "right":
1367  self._l.SetTextAlign(31)
1368  else:
1369  raise Exception("Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1370  else:
1371  self._l.SetTextAlign(align)
1372  self._l.SetTextColor(color)

Member Function Documentation

def plotting.PlotText.Draw (   self,
  options = None 
)
Draw the text to the current TPad.

Arguments:
options -- For interface compatibility, ignored

Provides interface compatible with ROOT's drawable objects.

Definition at line 1373 of file plotting.py.

References Vispa.Gui.VispaWidget.TextField._text, plotting.PlotText._text, PGeometricDet::Item._x, SpecificationBuilder_cfi.Specification._x, hitfit::Fourvec_Event._x, plotting.PlotText._x, PGeometricDet::Item._y, contrib::CMSBoostedTauSeedingAlgorithmStructure._y, SpecificationBuilder_cfi.Specification._y, and plotting.PlotText._y.

1374  def Draw(self, options=None):
1375  """Draw the text to the current TPad.
1376 
1377  Arguments:
1378  options -- For interface compatibility, ignored
1379 
1380  Provides interface compatible with ROOT's drawable objects.
1381  """
1382  self._l.DrawLatex(self._x, self._y, self._text)
1383 

Member Data Documentation

plotting.PlotText._l
private

Definition at line 1352 of file plotting.py.

plotting.PlotText._text
private

Definition at line 1350 of file plotting.py.

Referenced by plotting.PlotText.Draw().

plotting.PlotText._x
private

Definition at line 1348 of file plotting.py.

Referenced by plotting.PlotText.Draw().

plotting.PlotText._y
private

Definition at line 1349 of file plotting.py.

Referenced by plotting.PlotText.Draw().