- 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', clipItem=None)¶
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.
Emitted when the user has finished dragging the region (or one of its lines) and when the region is changed programatically.
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', clipItem=None)¶
Create a new LinearRegionItem.
A list of the positions of the lines in the region. These are not limits; limits can be set by specifying bounds.
Options are ‘vertical’ or ‘horizontal’ The default is ‘vertical’, indicating that the region is bounded by vertical lines.
Defines the brush that fills the region. Can be any arguments that are valid for
mkBrush. Default is transparent blue.
The pen to use when drawing the lines that bound the region.
The brush to use when the mouse is hovering over the region.
The pen to use when the mouse is hovering over the region.
If True, the region and individual lines are movable by the user; if False, they are static.
Optional [min, max] bounding values for the region
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.
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”.
An item whose bounds will be used to limit the region bounds. This is useful when a LinearRegionItem is added on top of an
PlotDataItemand the visual region should not extend beyond its range. This overrides
Return the values at the edges of the region.
(min, max)bounding values for the region.
The current position is only affected it is outside the new bounds. See
setRegion()to set the position of the region.
(None, None)to disable bounds.
- setBrush(*br, **kargs)¶
Set the brush that fills the region. Can have any arguments that are valid for
Set an item to which the region is bounded.
None, bounds are disabled.
- setHoverBrush(*br, **kargs)¶
Set the brush that fills the region when the mouse is hovering over. Can have any arguments that are valid for
Set lines to be movable by the user, or not. If lines are movable, they will also accept HoverEvents.
Set the values for the edges of the region.
A list or tuple of the lower and upper values.