LayerArtist#

class glue.viewers.common.layer_artist.LayerArtist(viewer_state, layer_state=None, layer=None)[source]#

Bases: LayerArtistBase

Create a new LayerArtist

Parameters:
layerData or Subset

Data or Subset to draw

layerData or glue.core.subset.Subset

Attributes Summary

disabled_message

Returns why a layer is disabled

enabled

layer

The Data or Subset visualized in this layer

properties

A dict mapping property names to values

visible

A property that callback functions can be added to.

zorder

A property that callback functions can be added to.

Methods Summary

clear()

Clear the visualization for this layer

disable(reason)

Disable the layer for a particular reason.

disable_incompatible_subset()

Disable a layer because the subset mask cannot be computed.

disable_invalid_attributes(*attributes)

Disable a layer because visualization depends on knowing a set of ComponentIDs that cannot be derived from a dataset or subset

enable()

force_update(*args, **kwargs)

Sets the _changed flag to true, and calls update.

get_layer_color()

pop_changed_properties()

Return the names of properties on the viewer and layer state classes that have changed since the last call.

redraw()

Re-render the plot

remove()

Remove the visualization for this layer.

update()

Sync the visual appearance of the layer, and redraw

Attributes Documentation

disabled_message#

Returns why a layer is disabled

enabled = None#
layer#

The Data or Subset visualized in this layer

properties#

A dict mapping property names to values

visible#

A property that callback functions can be added to.

When a callback property changes value, each callback function is called with information about the state change. Otherwise, callback properties behave just like normal instance variables.

CallbackProperties must be defined at the class level. Use the helper function add_callback() to attach a callback to a specific instance of a class with CallbackProperties

Parameters:
default

The initial value for the property

docstringstr

The docstring for the property

getter, setterfunc

Custom getter and setter functions (advanced)

zorder#

A property that callback functions can be added to.

When a callback property changes value, each callback function is called with information about the state change. Otherwise, callback properties behave just like normal instance variables.

CallbackProperties must be defined at the class level. Use the helper function add_callback() to attach a callback to a specific instance of a class with CallbackProperties

Parameters:
default

The initial value for the property

docstringstr

The docstring for the property

getter, setterfunc

Custom getter and setter functions (advanced)

Methods Documentation

clear()#

Clear the visualization for this layer

disable(reason)#

Disable the layer for a particular reason.

Layers should only be disabled when drawing is impossible, e.g. because a subset cannot be applied to a dataset.

Parameters:
reasonstr

A short explanation for why the layer can’t be drawn. Used by the UI

disable_incompatible_subset()#

Disable a layer because the subset mask cannot be computed.

Automatically generates a disabled message.

disable_invalid_attributes(*attributes)#

Disable a layer because visualization depends on knowing a set of ComponentIDs that cannot be derived from a dataset or subset

Automatically generates a disabled message.

Parameters:
attributessequence of ComponentIDs
enable()#
force_update(*args, **kwargs)#

Sets the _changed flag to true, and calls update.

Force an update of the layer, overriding any caching that might be going on for speed

get_layer_color()#
pop_changed_properties()[source]#

Return the names of properties on the viewer and layer state classes that have changed since the last call.

Note that calling this method updates the underlying cache, so if it is called immediately after being called a first time, it will return an empty set the second time.

redraw()#

Re-render the plot

remove()#

Remove the visualization for this layer.

This is called when the layer artist is removed for good from the viewer. It defaults to calling clear, but can be overriden in cases where clear and remove should be different.

update()#

Sync the visual appearance of the layer, and redraw