This is documentation for Orange 2.7. For the latest documentation, see Orange 3.

Curve (owcurve)

class Orange.OrangeWidgets.plot.owcurve.OWPlotItem

This class represents a base for any item than can be added to a plot.


Attaches this item to plot. The Plot takes the ownership of this item.

Parameters:plot (OWPlot) – the plot to which to add this item
Seealso :OWPlot.add_item().

Removes this item from its plot. The item’s ownership is returned to Python.

Returns:The plot this item is attached to. If the item is not attached to any plot, None is returned.
Return type:OWPlot

Returns the bounding rectangle of this item in data coordinates. This method is used in autoscale calculations.

Parameters:rect (QRectF) – The new bounding rectangle in data coordinates

Sets the graph transform (the transformation that maps from data to plot coordinates) for this item.

Returns:The current graph transformation.
Return type:QTransform

Sets the zoom transform (the transformation that maps from plot to scene coordinates) for this item.

Returns:The current zoom transformation.
Return type:QTransform
set_axes(x_axis, y_axis)

Sets the pair of axes used for positioning this item.

Returns:The item’s pair of axes
Return type:tuple of int int

Called by the plot, this function is supposed to updates the item’s internal state to match its settings.

The default implementation does nothing and shold be reimplemented by subclasses.


If this item constains any points (of type OWPoint), add them to the plot in this function.

The default implementation does nothing.


If background is True, the item is moved to be background of this plot, behind other items and axes. Otherwise, it’s brought to the front, in front of axes.

The default in False, so that items apper in front of axes.


Returns if item is in the background, set with set_in_background().


Often you will want to create a custom curve class that inherits from OWCurve. For this purpose, OWPlotItem provides two virtual methods: paint() and update_properties().

  • update_properties() is called whenever a curve or the plot is changed and needs to be updated. In this method, child items and other members should be recalculated and updated. The OWCurve even provides a number of methods for asynchronous (threaded) updating.
  • paint() is called whenever the item needs to be painted on the scene. This method is called more often, so it’s advisable to avoid long operation in the method.

Most provided plot items, including OWCurve, OWMultiCurve and utility curves in owtools only reimplement the first method, because they are optimized for performance with large data sets.

class Orange.OrangeWidgets.plot.owcurve.OWCurve(xData=[], yData=[], x_axis_key=2, y_axis_key=0, tooltip=None)

This class represents a curve on a plot. It is essentially a plot item with a series of data points or a continuous line.

  • xData (list of float) – list of x coordinates
  • yData (list of float) – list of y coordinates
  • x_axis_key (int) – The x axis of this curve
  • y_axis_key (int) – The y axis of this curve
  • tooltip (str) – The curve’s tooltip


All the points or line segments in an OWCurve have the same properties. Different points in one curve are supported by the OWMultiCurve class.

point_item(x, y, size=0, parent=None)

Returns a single point with this curve’s properties. It is useful for representing the curve, for example in the legend.

  • x (float) – The x coordinate of the point.
  • y (float) – The y coordinate of the point.
  • size (int) – If nonzero, this argument determines the size of the resulting point. Otherwise, the point is created with the curve’s OWCurve.point_size()
  • parent (QGraphicsItem) – An optional parent for the returned item.

The name of the curve, used in the legend or in tooltips.

set_data(x_data, y_data)

Sets the curve’s data to a list of coordinates specified by x_data and y_data.

Returns:The curve’s data as a list of data points.
Return type:list of tuple of float float

Sets the curve’s style to style.

The following values are recognized by OWCurve:

Value Result
OWCurve.Points Only points are shown, no lines
OWCurve.Lines A continuous line is shown, no points
OWCurve.LinesPoints Both points and lines between them are shown
OWCurve.Dots A dotted line is shown, no points
OWCurve.NoCurve Deprecated, same as OWCurve.Points

Curve subclasses can use this value for different drawing modes. Values up to OWCurve.UserCurve are reserved, so use only higher numbers, like the following example:

class MyCurve(OWCurve):
    PonyStyle = OWCurve.UserCurve + 42

    def draw_ponies()
        # Draw type-specific things here

    def update_properties(self):
        if == PonyStyle:
Returns:The curve’s style, set with set_style()
Return type:int

Cancel all pending threaded updates and block until they are finished. This is usually called before starting a new round of updates.


Resizes the point list so that it matches the number of data points in data()


Sets the coordinates of each point to match data().


Sets the scene positions of the points to match their data coordinates.

class Orange.OrangeWidgets.plot.owcurve.OWMultiCurve

A multi-curve is a curve in which each point can have its own properties. The point coordinates can be set by calling OWCurve.set_data(), just like in a normal curve.

In addition, OWMultiCurve provides methods for setting properties for individual points. Each of this methods take a list as a parameter. If the list has less elements that the curve’s data, the first element is used for all points.

Parameters:lst (list of QColor) – The list of colors to assign to points
Parameters:lst (list of int) – The list of sizes to assign to points
Parameters:lst (list of int) – The list of symbols to assign to points