Plot.Line

class Line(x, y, tooltips=None, selectable=True)

A line display a line in a plot.

Parameters:
  • x (Sequence | PhysicalQuantity | ndarray) – The x-data of the line.
  • y (Sequence | PhysicalQuantity | ndarray) – The y-data of the line.
  • tooltips (list | list of str) – The line tooltips.
  • selectable (bool) – True, if the line is selectable.
addItem(item, emit=True)

Add item as child of this item.

Parameters:
  • item (PlotItem based) – The item.
  • emit (bool) – True, if change should be emitted.
addSubscriber(subscriber)

Add a subscriber. Each subscriber is called once every time the plot item updates.

Parameters:subscriber (bound method) – The subscriber. Must be callable.
addTag(*args)

Add tag. Used for gouping plot items.

Parameters:*args

The tags to add.

alpha()
Returns:The opacity for the line.
Return type:float
color()
Returns:The line color.
Return type:str
copy()

Make a copy of the plot storable by using the serialize/deserialize functionality.

This creates a new instance with a new id, but all other properties copied.

emit(key, value=None)

Emit a single key and value change to all subscribers.

Parameters:
  • key (str) – The key to emit.
  • value (object) – The value to emit.
extent(axis_name, padding=0.0)

Get the data extent.

Parameters:
  • axis_name (str) – ‘x’ or ‘y’.
  • padding (float) – Padding around the data.
    Default: 0.0.
Returns:

The min/max data values for the requested axis.

Return type:

PhysicalQuantity

classmethod fromProperties(properties)

Create a plot storable from a dict of properties.

Used when deserializing a PlotStorable.

Parameters:properties (dict) – The properties which are used to populate the properties dict of the newly created plot storable.
Returns:The newly created PlotStorable.
Return type:PlotStorable
hoverDetails()

. :returns: The current hover details. :rtype: dict | None

isHoverable()
Returns:True, if hoverable.
Return type:bool
isHovered()
Returns:True, if the item is hovered.
Return type:bool
isSelectable()
Returns:True, if the item is selectable.
Return type:bool
isSelected()
Returns:True, if the item is selected.
Return type:bool
isVisible()
Returns:True, if the item is visible.
Return type:bool
items(selected=None, tag=None)

Return the requested items.

The optional selected key word filter selected and deselected lines, with the options:

  • True : Only selected items
  • False : Only unselected items
  • None : All items.
Parameters:
  • selected (None | bool) – True, if only selected items should be returned.
  • tag (str) – The tag to filter on.
Returns:

The child items with the selected filtering.

Return type:

items

label()
Returns:The line label.
Return type:str
lineStyle()
Returns:The line style.
Return type:str | None
lineWidth()

. :returns: The line width. :rtype: float

markerEdgeColor()
Returns:The edge color of the marker in hex format.
Return type:str
markerEvery()
Returns:The number of points between every marker.
Return type:int
markerFaceColor()
Returns:The face color of the marker in hex format.
Return type:str
markerSize()
Returns:The marker size.
Return type:float
markerStyle()

. :returns: The marker style. :rtype: str | None

model()
Returns:The model that this item belongs to.
Return type:PlotModel | None
order()
Returns:A number describing the current order of the item within the PlotModel. Can be used for sorting.
Return type:int | None
owner()
Returns:The owner type.
Return type:int | enum
parent()
Returns:The parent.
Return type:PlotItem based | None
removeItem(item, emit=True)

Remove item from the child items.

Parameters:
  • item (PlotItem based) – The item to remove.
  • emit (bool) – True, if removal should be emitted.
removeSubscriber(subscriber)

Remove a subscriber method from the plot item updates.

Parameters:subscriber (bound method) – The subscriber. Must be callable.
selectionDetails()
Returns:The current selection details.
Return type:dict | None
setAlpha(alpha)

Set the opacity for the line.

Parameters:alpha (float) – The opacity.
setColor(color)

Set the line color.

Parameters:color (str) – The line color in hex format.
setData(x=None, y=None, tooltips=None)

Set data.

Parameters:
  • x (Sequence | PhysicalQuantity | ndarray) – The x values.
  • y (Sequence | PhysicalQuantity | ndarray) – The y values.
  • tooltips (list of str | str) – Tooltips for each entry.
setHoverable(hoverable)

Enable or disable hover evetn. When enabled the line will be set to hovered, once the mouse hovers over the item.

Parameters:hoverable (bool) – True, if the item should be sensitive to hover events.
setHovered(hovered, details=None)

Set hovered with some details. This is called once the mouse hovers over the item. Should only be called once hoverable has been enabled.

Parameters:
  • hovered (bool) – True, if the item was hovered.
  • details (dict | NoneType) – The hover details.
setLabel(label)

Set the label.

Parameters:label (str) – The line label.
setLineStyle(line_style)

Set the line style.

Parameters:line_style (str | None) – The line style.
setLineWidth(line_width)

Set the line width.

Parameters:line_width (float) – The line width.
setMarkerColor(color)

Set color of the marker. Remember to also set a valid marker style.

Parameters:color (valid color) – The color to set.
setMarkerEdgeColor(color)

Set the marker edge color. Remember to also set a valid marker style.

Parameters:color (str) – The edge color of the marker.
setMarkerEvery(every)

Set the number of points between each marker. Remember to also set a valid marker style.

Parameters:every (int) – The number of points between every marker.
setMarkerFaceColor(color)

Set the marker face-color. Remember to also set a valid marker style.

Parameters:color (str) – The face color of the marker.
setMarkerSize(size)

Set the marker size. Remember to also set a valid marker style.

Parameters:size (float) – The marker size.
setMarkerStyle(marker)

Set the marker style.

Parameters:marker (str | None) – The marker style.
setOwner(owner)

Set the owner of the item (either OWNERS.MODEL or OWNERS.VIEW).

Parameters:owner (int | enum) – The owner type.
setSelectable(selectable)

Set whether this item is selectable.

Parameters:selectable (bool) – True, if the item should be selectable.
setSelected(selected, details=None)

Set the item as selected or unselected.

Parameters:
  • selected (bool) – True, if item should be selected.
  • details (dict | NoneType) – The selection details.
setVisible(visible)

Set visible.

Parameters:visible (bool) – True, if the item should be visible.
style()
Returns:All the current style properties.
Return type:dict
tags()
Returns:The set of tags.
Return type:set
tooltips()
Returns:The tooltips.
Return type:list of str | NoneType
xData()
Returns:The x-data.
Return type:PhysicalQuantity
yData()
Returns:The y-data.
Return type:PhysicalQuantity