LegendItem

class pyqtgraph.LegendItem(size=None, offset=None)

Displays a legend used for describing the contents of a plot. LegendItems are most commonly created by calling PlotItem.addLegend().

Note that this item should not be added directly to a PlotItem. Instead, Make it a direct descendant of the PlotItem:

legend.setParentItem(plotItem)
__init__(size=None, offset=None)
Arguments  
size Specifies the fixed size (width, height) of the legend. If this argument is omitted, the legend will autimatically resize to fit its contents.
offset Specifies the offset position relative to the legend’s parent. Positive values offset from the left or top; negative values offset from the right or bottom. If offset is None, the legend must be anchored manually by calling anchor() or positioned by calling setPos().
addItem(item, name)

Add a new entry to the legend.

Arguments  
item A PlotDataItem from which the line and point style of the item will be determined
title The title to display for this item. Simple HTML allowed.

Previous topic

VTickGroup

Next topic

GradientEditorItem

This Page