Plot.Contour

class Contour(x_data, y_data, z_data)

A Contour displays three-dimensional data in a number of discrete levels, colored accordingly, and with an additional color bar.

The x, y data are 1D arrays spanning the regular z mesh. The z data is a 2D array mesh with values of the (x, y) points.

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.

alpha()
Returns:

The opacity for the contour.

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 contour face color in HEX format.

Return type:

str

colorMap()
Returns:

The contour color map.

Return type:

str | None

colorMode()
Returns:

The current color mode.

Return type:

str

colors()
Returns:

The currnetly set list colors.

Return type:

List of colors | None

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 x-data or y-data limits.

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:

2-tuple of 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

isColorBarVisible()
Returns:

True, if colorbar is visible.

Return type:

bool

isFilled()
Returns:

True, if contour should be filled.

Return type:

bool

isHoverable()
Returns:

True, if hoverable.

Return type:

bool

isHovered()
Returns:

True, if the item is hovered.

Return type:

bool

isLabelsVisible()
Returns:

True, if contour labels should be visible.

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 label of the z-axis.

Return type:

str

labelFontSize()
Returns:

The label font size.

Return type:

int

labelsFontSize()
Returns:

The contour labels font size.

Return type:

int

levels()
Returns:

The number of contour levels.

Return type:

int

limits()
Returns:

The limits of the z-axis.

Return type:

List of PhysicalQuantity

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.

scale()
Returns:

The z-axis scale (‘linear’ | ‘log’).

Return type:

str

selectionDetails()
Returns:

The current selection details.

Return type:

dict | None

setAlpha(alpha)

Set the contour opacity as a float between zero and one.

Parameters:

alpha (float) – The opacity.

setColor(color)

Set the uniform color of entire contour.

Note that this color is only used if the color mode has been set to ‘color’.

Parameters:

color (Any matplotlib supported color definition) – The contour face color.

setColorBarVisible(visible)

Set colobar visibility.

Parameters:

visible (bool.) – True, if colorbar should be shown.

setColorMap(color_map)

Set the contour color map.

Note that this color map is only used if the color mode has been set to ‘color_map’.

Parameters:

color_map (str) – The color map.

setColorMode(mode)

Set the color mode.

Parameters:

mode (COLOR_MODES enum | str) – The mode to set (‘color’, ‘colors’, ‘color_map’).

setColors(colors)

Set the color sof the different contour levels.

Note that these colors are only used if the color mode has been set to ‘colors’.

Parameters:

colors (List of colors | None) – The colors to set.

setData(x_data, y_data, z_data)

Set the data used in the contour.

Parameters:
setFilled(filled)

Set whether the contour should be filled with colors.

Parameters:

filled (bool) – True, if contour should be filled.

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 z-axis label.

Parameters:

label (str) – Set z-axis label.

setLabelFontSize(font_size)

Set label font size.

Parameters:

font_size (int) – The label font size.

setLabelsFontSize(font_size)

Set contour labels font size.

Parameters:

font_size (int) – The font size.

setLabelsVisible(visible)

True, if contour labels should be visible.

Only applies to unfilled contours.

Parameters:

visible (bool) – True, if visible.

setLevels(levels)

Set number of contour levels.

Parameters:

levels (int) – The number of different contour levels.

setLimits(lower_limit=None, upper_limit=None)

Set the z-axis limits.

Parameters:
  • lower_limit (float) – The lower z-axis limit.

  • upper_limit (float) – The upper z-axis limit.

setOwner(owner)

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

Parameters:

owner (int | enum) – The owner type.

setScale(scale)

Set the z-axis scale to either linear or log.

Parameters:

scale (str) – The z-axis scale (‘linear’ | ‘log’).

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.

setTickFontSize(font_size)

Set the color bar tick font size.

Parameters:

font_size (int) – The font size.

setUnit(unit)

Set the unit of the z-scale.

Parameters:

unit (Unit) – The z-axis unit.

setVisible(visible)

Set visible.

Parameters:

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

setZData(z_data)

Set z data.

Parameters:

z_data (PhysicalQuantity | ndarray) – The two-dimensional z data.

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

tickFontSize()
Returns:

The color bar tick font size.

Return type:

int

unit()
Returns:

The unit of the z-axis.

Return type:

Unit

xData()
Returns:

The one-dimensional x data.

Return type:

PhysicalQuantity

yData()
Returns:

The one-dimensional y data.

Return type:

PhysicalQuantity

zData()
Returns:

The two-dimensional z data.

Return type:

PhysicalQuantity