Plot.Scatter

class Scatter(x=None, y=None, values=None)

A Scatter displays x- and y-data as a scatter plot.

Parameters:
  • x (Sequence | PhysicalQuantity | None) – The x-values of the data.

  • y (Sequence | PhysicalQuantity | None) – The y-values of the data.

  • values (Sequence | None) – The values of the data. Used for coloring or resizing the data points.

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 grouping plot items.

Parameters:

*args (tuple of str) – The tags to add.

alpha()
Returns:

The opacity of the points.

Return type:

float

applyStyle(style_scheme=None, style_properties=None)

Apply style properties from a style scheme.

Parameters:
  • style_scheme (dict) – The style scheme.

  • style_properties (dict | None) – A specific set of style properties to apply. If None, the style properties are retrieved from the plot model using the given style scheme.

color()
Returns:

The face color in hex format.

Return type:

str

colorMap()

. :returns: The color map. :rtype: str

colorMode()
Returns:

The color mode.

Return type:

COLOR_MODES enum

colors()
Returns:

The colors.

Return type:

None | list of 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.

Return type:

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 current scatter label.

Return type:

str

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

outline()
Returns:

True, if the scatter circles should be outlined.

Return type:

bool

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.

scaling()
Returns:

The scaling parameters.

Return type:

tuple

selectionDetails()
Returns:

The current selection details.

Return type:

dict | None

setAlpha(alpha)
Parameters:

alpha (float) – The opacity of the points.

setColor(color)

Set the uniform color.

Note that this color is only used when color mode is set to COLOR.

Parameters:

color (str) – The face color.

setColorMap(color_map)

The color map.

Note that the color map is only used when the color mode is set to COLOR_MAP.

Parameters:

color_map (None | str) – The color map to use.

setColorMode(mode)

Set the color mode. One of either COLOR_MODES.COLOR, COLOR_MODES.COLORS, COLOR_MODES.COLOR_MAP.

Parameters:

mode (COLOR_MODES enum) – The mode to set.

setColors(colors)

Set the colors.

Note that the colors are only used when the color mode is set to COLORS

Parameters:

colors (None | list of str) – The colors in hex format.

setData(x=None, y=None, tooltips=None)

Set the scatter data.

Parameters:
  • x (list | ndarray | PhysicalQuantity) – The x-data.

  • y (list | ndarray | PhysicalQuantity) – The y-data.

  • tooltips (list | str | NoneType) – The corresponding tool tips.

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 scatter label.

Parameters:

label (str) – The label of the scatter.

setOutline(outline)

Set the outline property.

Parameters:

outline (bool) – True, if the scatter circles should be outlined.

setOwner(owner)

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

Parameters:

owner (int | enum) – The owner type.

setScaling(lower, upper, use_absolute_values=False)

Scale points based on their values. Requires values to be specified to have any effect.

Parameters:
  • lower (float) – The size of the smallest value.

  • upper (float) – The size of the largest value.

  • use_absolute_values (bool) – Use absolute values when scaling the points.

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.

setValues(values)

Set the weights of the data.

Parameters:

values (Sequence | None) – The values of the data. Used for coloring or resizing the data points.

setVisible(visible)

Set visible.

Parameters:

visible (bool) – True, if the item should be visible.

style()
Returns:

The current scatter style properties.

Return type:

dict

styleProperties(style_scheme)

Check if the given style scheme has a style for this item.

Parameters:

style_scheme (dict) – The style scheme.

Returns:

The style, if any.

Return type:

dict | None

tags()
Returns:

The set of tags.

Return type:

set

tooltips()
Returns:

The tool tips.

Return type:

list of str | str | NoneType

values()
Returns:

The weights of the data. Used for coloring or setting line widths.

Return type:

Sequence | None

xData()
Returns:

The x-data.

Return type:

PhysicalQuantity

yData()
Returns:

The y-data.

Return type:

PhysicalQuantity