BoxesStyle#

class movement.napari.layer_styles.BoxesStyle(name, visible=True, blending='translucent', edge_width=3, opacity=1.0, shape_type='rectangle', face_color='#FFFFFF00', edge_colormap='turbo', text=<factory>)[source]#

Bases: LayerStyle

Style properties for a napari Shapes layer.

Methods

as_kwargs()

Return the style properties as a dictionary of kwargs.

set_color_by(property, properties_df[, cmap])

Color boxes and text by chosen column in the properties DataFrame.

set_text_by(property)

Set the text property for the boxes layer.

as_kwargs()#

Return the style properties as a dictionary of kwargs.

Return type:

dict

set_color_by(property, properties_df, cmap=None)[source]#

Color boxes and text by chosen column in the properties DataFrame.

Parameters:
  • property (str) – The column name in the properties DataFrame to color shape edges and associated text by.

  • properties_df (pd.DataFrame) – The properties DataFrame containing the data for generating the colormap.

  • cmap (str, optional) – The name of the colormap to use, otherwise use the edge_colormap.

Return type:

None

Notes

The input property is expected to be a column in the properties dataframe and it is used to define the color of the text. A factorized version of the property (“<property>_factorized”) is used to define the edges color, and is also expected to be present in the properties dataframe.

set_text_by(property)[source]#

Set the text property for the boxes layer.

Parameters:

property (str) – The column name in the properties DataFrame to use for text.

Return type:

None