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