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.
1535 def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1539 x -- X coordinate of the text (in NDC)
1540 y -- Y coordinate of the text (in NDC)
1541 text -- String to draw
1542 size -- Size of text (None for the default value, taken from gStyle)
1543 bold -- Should the text be bold?
1544 align -- Alignment of text (left, center, right)
1545 color -- Color of the text
1546 font -- Specify font explicitly
1552 self.
_l = ROOT.TLatex()
1555 self._l.SetTextFont(self._l.GetTextFont()-20)
1556 if font
is not None:
1557 self._l.SetTextFont(font)
1558 if size
is not None:
1559 self._l.SetTextSize(size)
1560 if isinstance(align, str):
1561 if align.lower() ==
"left":
1562 self._l.SetTextAlign(11)
1563 elif align.lower() ==
"center":
1564 self._l.SetTextAlign(21)
1565 elif align.lower() ==
"right":
1566 self._l.SetTextAlign(31)
1568 raise Exception(
"Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1570 self._l.SetTextAlign(align)
1571 self._l.SetTextColor(color)