LinearRegionItem — pyqtgraph 0.11.0rc0 documentation

# LinearRegionItem

class `pyqtgraph.` `LinearRegionItem`(values=(0, 1), orientation='vertical', brush=None, pen=None, hoverBrush=None, hoverPen=None, movable=True, bounds=None, span=(0, 1), swapMode='sort')

  Bases: `GraphicsObject`

  Used for marking a horizontal or vertical region in plots. The region can be dragged and is bounded by lines which can be dragged individually.

  Signals: |
  sigRegionChangeFinished(self) | Emitted when the user has finished dragging the region (or one of its lines) and when the region is changed programatically.
  sigRegionChanged(self) | Emitted while the user is dragging the region (or one of its lines) and when the region is changed programatically.

  `__init__`(values=(0, 1), orientation='vertical', brush=None, pen=None, hoverBrush=None, hoverPen=None, movable=True, bounds=None, span=(0, 1), swapMode='sort')

    Create a new LinearRegionItem.

    Arguments: |
    values | A list of the positions of the lines in the region. These are not limits; limits can be set by specifying bounds.
    orientation | Options are ‘vertical’ or ‘horizontal’, indicating the The default is ‘vertical’, indicating that the
    brush | Defines the brush that fills the region. Can be any arguments that are valid for `mkBrush`. Default is transparent blue.
    pen | The pen to use when drawing the lines that bound the region.
    hoverBrush | The brush to use when the mouse is hovering over the region.
    hoverPen | The pen to use when the mouse is hovering over the region.
    movable | If True, the region and individual lines are movable by the user; if False, they are static.
    bounds | Optional [min, max] bounding values for the region
    span | Optional [min, max] giving the range over the view to draw the region. For example, with a vertical line, use span=(0.5, 1) to draw only on the top half of the view.
    swapMode | Sets the behavior of the region when the lines are moved such that their order reverses: * “block” means the user cannot drag one line past the other * “push” causes both lines to be moved if one would cross the other * “sort” means that lines may trade places, but the output of getRegion always gives the line positions in ascending order. None means that no attempt is made to handle swapped line positions. The default is “sort”.

  `boundingRect`(self) → PySide2.QtCore.QRectF
  `getRegion`()

    Return the values at the edges of the region.

  `paint`(self, painter: PySide2.QtGui.QPainter, option: PySide2.QtWidgets.QStyleOptionGraphicsItem, widget: typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)
  `setBounds`(bounds)

    Optional [min, max] bounding values for the region. To have no bounds on the region use [None, None]. Does not affect the current position of the region unless it is outside the new bounds. See `setRegion` to set the position of the region.

  `setBrush`(*br, **kargs)

    Set the brush that fills the region. Can have any arguments that are valid for `mkBrush`.

  `setHoverBrush`(*br, **kargs)

    Set the brush that fills the region when the mouse is hovering over. Can have any arguments that are valid for `mkBrush`.

  `setMovable`(m)

    Set lines to be movable by the user, or not. If lines are movable, they will also accept HoverEvents.

  `setRegion`(rgn)

    Set the values for the edges of the region.

    Arguments: |
    rgn | A list or tuple of the lower and upper values.