NapariMPLWidget#
-
class napari_matplotlib.base.NapariMPLWidget(napari_viewer:
napari.Viewer
, parent: QWidget | None = None)# Bases:
BaseNapariMPLWidget
Widget containing a Matplotlib canvas and toolbar.
In addition to
BaseNapariMPLWidget
, this class handles callbacks to automatically update figures when the layer selection or z-step is changed in the napari viewer. To take advantage of this sub-classes should implement theclear()
anddraw()
methods.When both the z-step and layer selection is changed,
clear()
is called and if the number a type of selected layers are valid for the widgetdraw()
is then called. When layer selection is changedon_update_layers()
is also called, which can be useful e.g. for updating a layer list in a selection widget.See also
BaseNapariMPLWidget
The parent class of this widget. Contains helpful methods for creating and working with the Matplotlib figure and any axes.
- Attributes:
- viewer
napari.Viewer
Main napari viewer.
- layers
list
List of currently selected napari layers.
- viewer
Attributes Summary
Current z-step of the napari viewer.
Type of layer taken as input
Number of layers taken as input
Number of currently selected layers.
Methods Summary
clear
()Clear any previously drawn figures.
draw
()Re-draw any figures.
Called when the selected layers are updated.
Attributes Documentation
- current_z#
Current z-step of the napari viewer.
- input_layer_types: tuple[Layer, ...] = (<class 'napari.layers.base.base.Layer'>,)#
Type of layer taken as input
- n_layers_input = Interval(None, None)#
Number of layers taken as input
- n_selected_layers#
Number of currently selected layers.
Methods Documentation
- clear() None #
Clear any previously drawn figures.
This is a no-op, and is intended for derived classes to override.