Plot.Density¶
- class Density(x=None, y=None, weights=None)¶
A density plot item to effeciently show the density of (very many) points.
- Parameters:
x (
PhysicalQauntity
|ndarray
) – The x coordinates.y (
PhysicalQauntity
|ndarray
) – The y coordinates.weights (
PhysicalQauntity
|ndarray
) – The optional weights.
- 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.
- 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.
- broadening()¶
- Returns:
The broadening.
- Return type:
float
- color()¶
- Returns:
The color in hex format.
- Return type:
str
- colorMap()¶
The color map to use..
- Returns:
The color map.
- Return type:
str
- colorMode()¶
The current color mode.
When set to COLOR_MODES.COLOR, the density is colored using the current color. When set to COLOR_MODES.COLOR_MAP colors the density using the current color_map.
- Returns:
The color mode (colormap or color)
- Return type:
COLOR_MODES enum
- 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.
- dpi()¶
- Returns:
The resolution in dots per inch.
- Return type:
int
- 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 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
PhysicalQauntity
- 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 density label.
- Return type:
str
- limits()¶
- Returns:
The limits of the color axis.
- Return type:
2-tuple of float
- 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.
- resampler()¶
- Returns:
The resampler.
- Return type:
PlotStorable with resample method | NoneType
- selectionDetails()¶
- Returns:
The current selection details.
- Return type:
dict | None
- setAlpha(alpha)¶
Set the opacity.
- Parameters:
alpha (float) – The opacity.
- setBroadening(broadening)¶
Set the broadening.
- Parameters:
broadening (float) – The broadening.
- setColor(color)¶
Set the color.
- Parameters:
color (str |
QColor
) – The color to set.
- setColorMap(color_map)¶
Set the color map.
- Parameters:
color_map (str) – The color map.
- setColorMode(mode)¶
Set the color mode.
- Parameters:
mode (COLOR_MODES enum) – The mode to set.
- setData(x_data, y_data, weights=None)¶
Set data.
- Parameters:
x_data (
PhysicalQauntity
|ndarray
) – The one-dimensional x data.y_data (
PhysicalQauntity
|ndarray
) – The one-dimensional y data.weights (
ndarray
| None) – The optional weights.
- setDpi(dpi)¶
Set the resolution in dots per inch.
- Parameters:
dpi (int) – The resolution in dots per inch.
- 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 density label.
- Parameters:
label (str) – The label.
- setLimits(lower_limit, upper_limit)¶
Set the color axis limit.
- Parameters:
lower_limit (float | NoneType) – The lower limit.
upper_limit (float | NoneType) – The upper limit.
- setOwner(owner)¶
Set the owner of the item (either OWNERS.MODEL or OWNERS.VIEW).
- Parameters:
owner (int | enum) – The owner type.
- setResampler(resampler)¶
Set the resampler used to dynamically upsample or downsample the data.
- Parameters:
resampler (Any PlotStorable with a resample method | None) – The resampler.
- 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.
- setWeights(weights)¶
Set the weights.
- Parameters:
weights (
PhysicalQauntity
|ndarray
) – The weights.
- 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
- weights()¶
- Returns:
The weights if any.
- Return type:
ndarray | None
- xData()¶
The 1D x-data.
- Returns:
The x data.
- Return type:
PhysicalQauntity
|ndarray
- yData()¶
The 1D y-data.
- Returns:
The y data.
- Return type:
PhysicalQauntity
|ndarray