CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, kwargs)
 
def addText (self, text)
 
def Draw (self, options="")
 
def move (self, dx=0, dy=0, dw=0, dh=0)
 
def width (self)
 

Private Attributes

 _currenty
 
 _fillColor
 
 _lineheight
 
 _pave
 
 _textArgs
 
 _texts
 
 _transparent
 
 _xmax
 
 _xmin
 
 _ymax
 
 _ymin
 

Detailed Description

Class for drawing text and a background box.

Definition at line 1580 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotTextBox.__init__ (   self,
  xmin,
  ymin,
  xmax,
  ymax,
  lineheight = 0.04,
  fillColor = ROOT.kWhite,
  transparent = True,
  kwargs 
)
Constructor

Arguments:
xmin        -- X min coordinate of the box (NDC)
ymin        -- Y min coordinate of the box (NDC) (if None, deduced automatically)
xmax        -- X max coordinate of the box (NDC)
ymax        -- Y max coordinate of the box (NDC)
lineheight  -- Line height
fillColor   -- Fill color of the box
transparent -- Should the box be transparent? (in practive the TPave is not created)

Keyword arguments are forwarded to constructor of PlotText

Definition at line 1582 of file plotting.py.

1582  def __init__(self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, **kwargs):
1583  """Constructor
1584 
1585  Arguments:
1586  xmin -- X min coordinate of the box (NDC)
1587  ymin -- Y min coordinate of the box (NDC) (if None, deduced automatically)
1588  xmax -- X max coordinate of the box (NDC)
1589  ymax -- Y max coordinate of the box (NDC)
1590  lineheight -- Line height
1591  fillColor -- Fill color of the box
1592  transparent -- Should the box be transparent? (in practive the TPave is not created)
1593 
1594  Keyword arguments are forwarded to constructor of PlotText
1595  """
1596  # ROOT.TPave Set/GetX1NDC() etc don't seem to work as expected.
1597  self._xmin = xmin
1598  self._xmax = xmax
1599  self._ymin = ymin
1600  self._ymax = ymax
1601  self._lineheight = lineheight
1602  self._fillColor = fillColor
1603  self._transparent = transparent
1604  self._texts = []
1605  self._textArgs = {}
1606  self._textArgs.update(kwargs)
1607 
1608  self._currenty = ymax
1609 
def __init__(self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, kwargs)
Definition: plotting.py:1582

Member Function Documentation

def plotting.PlotTextBox.addText (   self,
  text 
)
Add text to current position

Definition at line 1610 of file plotting.py.

References plotting.PlotTextBox._currenty, plotting.PlotTextBox._lineheight, plotting.PlotTextBox._textArgs, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, and plotting.PlotTextBox._xmin.

1610  def addText(self, text):
1611  """Add text to current position"""
1612  self._currenty -= self._lineheight
1613  self._texts.append(PlotText(self._xmin+0.01, self._currenty, text, **self._textArgs))
1614 
def addText(self, text)
Definition: plotting.py:1610
def plotting.PlotTextBox.Draw (   self,
  options = "" 
)
Draw the box and the text to the current TPad.

Arguments:
options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects

Definition at line 1644 of file plotting.py.

References plotting.PlotTextBox._transparent, fftjetcms::LookupTable2d.ymin(), PixelClusterizerBase::AccretionCluster.ymin, dqmoffline::l1t::HistDefinition.ymin, Exhume::Event.ymin, cscdqm::AddressBox.ymin, and TrackerMap.ymin.

1644  def Draw(self, options=""):
1645  """Draw the box and the text to the current TPad.
1646 
1647  Arguments:
1648  options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects
1649  """
1650  if not self._transparent:
1651  ymin = self.ymin
1652  if ymin is None:
1653  ymin = self.currenty - 0.01
1654  self._pave = ROOT.TPave(self.xmin, self.ymin, self.xmax, self.ymax, 0, "NDC")
1655  self._pave.SetFillColor(self.fillColor)
1656  self._pave.Draw(options)
1657  for t in self._texts:
1658  t.Draw(options)
1659 
def Draw(self, options="")
Definition: plotting.py:1644
def plotting.PlotTextBox.move (   self,
  dx = 0,
  dy = 0,
  dw = 0,
  dh = 0 
)
Move the box and the contained text objects

Arguments:
dx -- Movement in x (positive is to right)
dy -- Movement in y (positive is to up)
dw -- Increment of width (negative to decrease width)
dh -- Increment of height (negative to decrease height)

dx and dy affect to both box and text objects, dw and dh
affect the box only.

Definition at line 1618 of file plotting.py.

References plotting.PlotTextBox._texts, MEGeom._xmax, HistoParams< T >._xmax, HistoParams< TH2F >._xmax, HistoParams< TProfile2D >._xmax, plotting.PlotTextBox._xmax, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, plotting.PlotTextBox._xmin, MEGeom._ymax, HistoParams< T >._ymax, HistoParams< TH2F >._ymax, HistoParams< TProfile2D >._ymax, plotting.PlotTextBox._ymax, MEGeom._ymin, HistoParams< T >._ymin, HistoParams< TH2F >._ymin, HistoParams< TProfile2D >._ymin, and plotting.PlotTextBox._ymin.

Referenced by Vispa.Gui.PortConnection.PointToPointConnection.updateConnection().

1618  def move(self, dx=0, dy=0, dw=0, dh=0):
1619  """Move the box and the contained text objects
1620 
1621  Arguments:
1622  dx -- Movement in x (positive is to right)
1623  dy -- Movement in y (positive is to up)
1624  dw -- Increment of width (negative to decrease width)
1625  dh -- Increment of height (negative to decrease height)
1626 
1627  dx and dy affect to both box and text objects, dw and dh
1628  affect the box only.
1629  """
1630  self._xmin += dx
1631  self._xmax += dx
1632  if self._ymin is not None:
1633  self._ymin += dy
1634  self._ymax += dy
1635 
1636  self._xmax += dw
1637  if self._ymin is not None:
1638  self._ymin -= dh
1639 
1640  for t in self._texts:
1641  t._x += dx
1642  t._y += dy
1643 
def move(self, dx=0, dy=0, dw=0, dh=0)
Definition: plotting.py:1618
def plotting.PlotTextBox.width (   self)

Member Data Documentation

plotting.PlotTextBox._currenty
private

Definition at line 1608 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._fillColor
private

Definition at line 1602 of file plotting.py.

plotting.PlotTextBox._lineheight
private

Definition at line 1601 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._pave
private

Definition at line 1654 of file plotting.py.

plotting.PlotTextBox._textArgs
private

Definition at line 1605 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._texts
private

Definition at line 1604 of file plotting.py.

Referenced by plotting.PlotTextBox.move().

plotting.PlotTextBox._transparent
private

Definition at line 1603 of file plotting.py.

Referenced by plotting.PlotTextBox.Draw().

plotting.PlotTextBox._xmax
private

Definition at line 1598 of file plotting.py.

Referenced by plotting.PlotTextBox.move(), and plotting.PlotTextBox.width().

plotting.PlotTextBox._xmin
private
plotting.PlotTextBox._ymax
private

Definition at line 1600 of file plotting.py.

Referenced by plotting.PlotTextBox.move().

plotting.PlotTextBox._ymin
private

Definition at line 1599 of file plotting.py.

Referenced by plotting.PlotTextBox.move().