Plot.Measure

class Measure(tail_x, tail_y, head_x, head_y)

A Measure shows the distance between its tail-point and head-point along the x- and y-axis.

A Measure can be interactively moved with the mouse and can snap to nearby points on e.g. a Line.

Parameters:
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.

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 measure 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.

fontSize()
Returns:

The measure label font size.

Return type:

float

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

isMovable()
Returns:

True, if the label is movable.

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

isSnapping()
Returns:

True, if snapping is active.

Return type:

bool

isVerticalLabelFlipped()
Returns:

True, if the label displaying measurement along the vertical axis is flipped.

Return type:

bool

isVisible()
Returns:

True, if the item is visible.

Return type:

bool

isXShown()
Returns:

True, if the x-measurement is shown.

Return type:

bool

isYShown()

[summary].

Returns:

True, if the y-measurement should be shown.

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

labelPosition()
Returns:

The label position in terms of whether they are inside or outside of the arrows.

Return type:

enum

lineWidth()
Returns:

The measure line width.

Return type:

float

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

positions()
Returns:

The postions of the arrow ends in the format (x1, y1, x2, y2).

Return type:

None | 4-tuple of PhysicalQuantity

precision()
Returns:

The number of significant digits shown the in measurement labels.

Return type:

int

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

setColor(color)

Set the color of the measure.

Parameters:

color (str) – A matplotlib compatible color.

setFontSize(fontsize)

Set the font size of the measure labels.

Parameters:

fontsize (float) – The font size.

setHeadPosition(x, y, emit=True)

Set the position.

Parameters:
  • x (PhysicalQuantity) – The x position.

  • y (PhysicalQuantity) – The y position.

  • emit (bool) – True, if signal should be emitted.

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.

setLabelPosition(position)

Set the label position to be either inside or outside of the arrows.

Parameters:

position (enum) – The position choice.

setLineWidth(line_width)

Set the line width.

Parameters:

line_width (float) – The measure line width.

setMovable(movable)

Set the movable property.

Parameters:

movable (bool) – True, if the label should be movable.

setOwner(owner)

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

Parameters:

owner (int | enum) – The owner type.

setPrecision(digits)

Set the number of significant digits to show in the measurement labels.

Parameters:

digits (int) – The number of significant digits.

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.

setSnapping(snap)

Set whether the measurement should snap to points on Line, Scatter or LineGroup.

Parameters:

snap (bool) – True, if the measurement should snap.

setTailPosition(x, y, emit=True)

The tail position.

Parameters:
  • x (PhysicalQuantity) – The tail x position.

  • y (PhysicalQuantity) – The tail y position.

  • emit (bool) – True, if signal should be emitted.

setVerticalLabelFlipped(flipped)

Set whether the label displaying measurement along the vertical axis is rotated 90 degrees.

Parameters:

flipped (bool) – True, if the label displaying measurement along the vertical axis is flipped.

setVisible(visible)

Set visible.

Parameters:

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

setXShown(x_measure_shown)

Set whether to show the x-meaurement.

Parameters:

x_measure_shown (bool) – True, if x-measurement should be shown.

setYShown(y_measure_shown)

Set whether to show the y-meaurement.

Parameters:

y_measure_shown – if y-measurement should be shown.

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