CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

 _l
 
 _text
 
 _x
 
 _y
 

Detailed Description

Abstraction on top of TLatex

Definition at line 1351 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 1353 of file plotting.py.

1353  def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1354  """Constructor.
1355 
1356  Arguments:
1357  x -- X coordinate of the text (in NDC)
1358  y -- Y coordinate of the text (in NDC)
1359  text -- String to draw
1360  size -- Size of text (None for the default value, taken from gStyle)
1361  bold -- Should the text be bold?
1362  align -- Alignment of text (left, center, right)
1363  color -- Color of the text
1364  font -- Specify font explicitly
1365  """
1366  self._x = x
1367  self._y = y
1368  self._text = text
1369 
1370  self._l = ROOT.TLatex()
1371  self._l.SetNDC()
1372  if not bold:
1373  self._l.SetTextFont(self._l.GetTextFont()-20) # bold -> normal
1374  if font is not None:
1375  self._l.SetTextFont(font)
1376  if size is not None:
1377  self._l.SetTextSize(size)
1378  if isinstance(align, basestring):
1379  if align.lower() == "left":
1380  self._l.SetTextAlign(11)
1381  elif align.lower() == "center":
1382  self._l.SetTextAlign(21)
1383  elif align.lower() == "right":
1384  self._l.SetTextAlign(31)
1385  else:
1386  raise Exception("Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1387  else:
1388  self._l.SetTextAlign(align)
1389  self._l.SetTextColor(color)
1390 
def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None)
Definition: plotting.py:1353

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 1391 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.

1391  def Draw(self, options=None):
1392  """Draw the text to the current TPad.
1393 
1394  Arguments:
1395  options -- For interface compatibility, ignored
1396 
1397  Provides interface compatible with ROOT's drawable objects.
1398  """
1399  self._l.DrawLatex(self._x, self._y, self._text)
1400 
1401 
def Draw(self, options=None)
Definition: plotting.py:1391

Member Data Documentation

plotting.PlotText._l
private

Definition at line 1370 of file plotting.py.

plotting.PlotText._text
private

Definition at line 1368 of file plotting.py.

Referenced by plotting.PlotText.Draw().

plotting.PlotText._x
private

Definition at line 1366 of file plotting.py.

Referenced by plotting.PlotText.Draw().

plotting.PlotText._y
private

Definition at line 1367 of file plotting.py.

Referenced by plotting.PlotText.Draw().