Abstraction on top of TLatex
Definition at line 1333 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 1335 of file plotting.py.
1336 def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
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
1353 self.
_l = ROOT.TLatex()
1356 self._l.SetTextFont(self._l.GetTextFont()-20)
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)
1369 raise Exception(
"Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1371 self._l.SetTextAlign(align)
1372 self._l.SetTextColor(color)