Plot legend (owlegend)

class OrangeWidgets.plot.owlegend.OWLegendItem(name, point, parent)

Represents a legend item with a title and a point symbol.

Parameters:
  • name (str) – The text to display
  • point (OWPoint) – The point symbol
  • parent (QGraphicsItem) – The parent item, passed to QGraphicsItem
class OrangeWidgets.plot.owlegend.OWLegendTitle(text, parent)

A legend item that shows text with a bold font and no symbol.

class OrangeWidgets.plot.owlegend.OWLegend(graph, scene)

A legend for OWPlot.

Its items are arranged into a hierarchy by category. This is useful when points differ in more than one attribute. In such a case, there can be one category for point color and one for point shape. Usually the category name will be the name of the attribute, while the item’s title will be the value.

Arbitrary categories can be created, for an example see OWPlot.update_axes(), which creates a special category for unused axes. decimals .. image:: files/legend-categories.png

In the image above, type and milk are categories with 7 and 2 possible values, respectively.

add_curve(curve)

Adds a legend item with the same point symbol and name as curve.

If the curve’s name contains the equal sign (=), it is split at that sign. The first part of the curve is a used as the category, and the second part as the value.

add_item(category, value, point)

Adds an item with title value and point symbol point to the specified category.

clear()

Removes all items from the legend

remove_category(category)

Removes category and all items that belong to it.

set_floating(floating, pos=None)

If floating is True, the legend can be dragged with the mouse. Otherwise, it’s fixed in its position.

If pos is specified, the legend is moved there.

set_orientation(orientation)

Sets the legend’s orientation to orientation.

update_items()

Updates the legend, repositioning the items according to the legend’s orientation.