InfiniteLine

class pyqtgraph.InfiniteLine(pos=None, angle=90, pen=None, movable=False, bounds=None, hoverPen=None, label=None, labelOpts=None, span=(0, 1), markers=None, name=None)[source]

Bases: GraphicsObject

Displays a line of infinite length. This line may be dragged to indicate a position in data coordinates.

Signals:  
sigDragged(self)  
sigPositionChangeFinished(self)  
sigPositionChanged(self)  
__init__(pos=None, angle=90, pen=None, movable=False, bounds=None, hoverPen=None, label=None, labelOpts=None, span=(0, 1), markers=None, name=None)[source]
Arguments:  
pos Position of the line. This can be a QPointF or a single value for vertical/horizontal lines.
angle Angle of line in degrees. 0 is horizontal, 90 is vertical.
pen Pen to use when drawing line. Can be any arguments that are valid for mkPen. Default pen is transparent yellow.
hoverPen Pen to use when the mouse cursor hovers over the line. Only used when movable=True.
movable If True, the line can be dragged to a new position by the user.
bounds Optional [min, max] bounding values. Bounds are only valid if the line is vertical or horizontal.
hoverPen Pen to use when drawing line when hovering over it. Can be any arguments that are valid for mkPen. Default pen is red.
label Text to be displayed in a label attached to the line, or None to show no label (default is None). May optionally include formatting strings to display the line value.
labelOpts A dict of keyword arguments to use when constructing the text label. See InfLineLabel.
span Optional tuple (min, max) giving the range over the view to draw the line. For example, with a vertical line, use span=(0.5, 1) to draw only on the top half of the view.
markers List of (marker, position, size) tuples, one per marker to display on the line. See the addMarker method.
name Name of the item
addMarker(marker, position=0.5, size=10.0)[source]

Add a marker to be displayed on the line.

Arguments  
marker String indicating the style of marker to add: ‘<|’, ‘|>’, ‘>|’, ‘|<’, ‘<|>’, ‘>|<’, ‘^’, ‘v’, ‘o’
position Position (0.0-1.0) along the visible extent of the line to place the marker. Default is 0.5.
size Size of the marker in pixels. Default is 10.0.
bounds()[source]

Return the (minimum, maximum) values allowed when dragging.

clearMarkers()[source]

Remove all markers from this line.

setAngle(angle)[source]

Takes angle argument in degrees. 0 is horizontal; 90 is vertical.

Note that the use of value() and setValue() changes if the line is not vertical or horizontal.

setBounds(bounds)[source]

Set the (minimum, maximum) allowable values when dragging.

setHoverPen(*args, **kwargs)[source]

Set the pen for drawing the line while the mouse hovers over it. Allowable arguments are any that are valid for mkPen.

If the line is not movable, then hovering is also disabled.

Added in version 0.9.9.

setMovable(m)[source]

Set whether the line is movable by the user.

setPen(*args, **kwargs)[source]

Set the pen for drawing the line. Allowable arguments are any that are valid for mkPen.

setValue(v)[source]

Set the position of the line. If line is horizontal or vertical, v can be a single value. Otherwise, a 2D coordinate must be specified (list, tuple and QPointF are all acceptable).

value()[source]

Return the value of the line. Will be a single number for horizontal and vertical lines, and a list of [x,y] values for diagonal lines.

viewTransformChanged()[source]

Called whenever the transformation matrix of the view has changed. (eg, the view range has changed or the view was resized)