- class pyqtgraph.PlotCurveItem(*args, **kargs)¶
Class representing a single plot curve. Instances of this class are created automatically as part of
PlotDataItem; these rarely need to be instantiated directly.
Fast data update
Fill under curve
Emitted when the data being plotted has changed
Emitted when the curve is clicked
- __init__(*args, **kargs)¶
Forwards all arguments to
Some extra arguments are accepted as well:
The parent GraphicsObject (optional)
If True, the item will emit
sigClickedwhen it is clicked on. Defaults to False.
Return a QPainterPath representing the clickable shape of the curve
- setBrush(*args, **kargs)¶
Sets the brush used when filling the area under the curve. All arguments are passed to
- setClickable(s, width=None)¶
Sets whether the item responds to mouse clicks.
The width argument specifies the width in pixels orthogonal to the curve that will respond to a mouse click.
Change the composition mode of the item. This is useful when overlaying multiple items.
Composition of the item, often used when overlaying items. Common options include:
QPainter.CompositionMode.CompositionMode_SourceOver(Default) Image replaces the background if it is opaque. Otherwise, it uses the alpha channel to blend the image with the background.
QPainter.CompositionMode.CompositionMode_OverlayImage color is mixed with the background color to reflect the lightness or darkness of the background
QPainter.CompositionMode.CompositionMode_PlusBoth the alpha and color of the image and background pixels are added together.
QPainter.CompositionMode.CompositionMode_PlusThe output is the image color multiplied by the background.
QPainter::CompositionModein the Qt Documentation for more options and details
- setData(*args, **kargs)¶
(numpy arrays) Data to display
Pen to use when drawing. Any single argument accepted by
Pen for drawing behind the primary pen. Usually this is used to emphasize the curve by providing a high-contrast border. Any single argument accepted by
(float or None) Fill the area under the curve to the specified value.
(bool) If True, an outline surrounding the fillLevel area is drawn.
Brush to use when filling. Any single argument accepted by
(bool) Whether to use antialiasing when drawing. This is disabled by default because it decreases performance.
(str or None) If ‘center’, a step is drawn using the x values as boundaries and the given y values are associated to the mid-points between the boundaries of each step. This is commonly used when drawing histograms. Note that in this case,
len(x) == len(y) + 1
If ‘left’ or ‘right’, the step is drawn assuming that the y value is associated to the left or right boundary, respectively. In this case
len(x) == len(y)If not passed or an empty string or None is passed, the step mode is not enabled.
Argument specifying how vertexes should be connected by line segments.‘all’ (default) indicates full connection.‘pairs’ draws one separate line segment for each two points given.‘finite’ omits segments attached to NaN or Inf values.For any other connectivity, specify an array of boolean values.
(bool, defaults to False) Optimization flag that can speed up plotting by not checking and compensating for NaN values. If set to True, and NaN values exist, the data may not be displayed or the plot may take a significant performance hit.
If non-keyword arguments are used, they will be interpreted as
setData(y)for a single argument and
setData(x, y)for two arguments.
Notes on performance:
Line widths greater than 1 pixel affect the performance as discussed in the documentation of
Sets the level filled to when filling under the curve
- setPen(*args, **kargs)¶
Set the pen used to draw the curve.
Sets the mode that decides whether or not lines are drawn as segmented lines. Drawing lines as segmented lines is more performant than the standard drawing method with continuous lines.
'auto'(default) segmented lines are drawn if the pen’s width > 1, pen style is a solid line, the pen color is opaque and anti-aliasing is not enabled.
'on'lines are always drawn as segmented lines
'off'lines are never drawn as segmented lines, i.e. the drawing method with continuous lines is used
- setShadowPen(*args, **kargs)¶
Set the shadow pen used to draw behind the primary pen. This pen must have a larger width than the primary pen to be visible. Arguments are passed to
When it is known that the plot data passed to
PlotCurveItemcontains only finite numerical values, the skipFiniteCheck property can help speed up plotting. If this flag is set and the data contains any non-finite values (such as NaN or Inf), unpredictable behavior will occur. The data might not be plotted, or there migth be significant performance impact.