Abstraction on top of TLatex
Definition at line 1531 of file plotting.py.
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 1533 of file plotting.py.
1533 def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1537 x -- X coordinate of the text (in NDC)
1538 y -- Y coordinate of the text (in NDC)
1539 text -- String to draw
1540 size -- Size of text (None for the default value, taken from gStyle)
1541 bold -- Should the text be bold?
1542 align -- Alignment of text (left, center, right)
1543 color -- Color of the text
1544 font -- Specify font explicitly
1550 self._l = ROOT.TLatex()
1553 self._l.SetTextFont(self._l.GetTextFont()-20)
1554 if font
is not None:
1555 self._l.SetTextFont(font)
1556 if size
is not None:
1557 self._l.SetTextSize(size)
1558 if isinstance(align, str):
1559 if align.lower() ==
"left":
1560 self._l.SetTextAlign(11)
1561 elif align.lower() ==
"center":
1562 self._l.SetTextAlign(21)
1563 elif align.lower() ==
"right":
1564 self._l.SetTextAlign(31)
1566 raise Exception(
"Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1568 self._l.SetTextAlign(align)
1569 self._l.SetTextColor(color)
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 1571 of file plotting.py.
1571 def Draw(self, options=None):
1572 """Draw the text to the current TPad.
1575 options -- For interface compatibility, ignored
1577 Provides interface compatible with ROOT's drawable objects.
1579 self._l.DrawLatex(self._x, self._y, self._text)
References plotting.PlotText._l, 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.