magicclass.ext.vispy package

Subpackages

Submodules

magicclass.ext.vispy.layer2d module

class magicclass.ext.vispy.layer2d.Curve(viewbox: ViewBox, x: ArrayLike, y: ArrayLike = None, face_color=None, edge_color=None, size: float = 7, name: str | None = None, lw: float = 1, ls: str = '-', symbol=None)[source]

Bases: magicclass.ext.vispy.layer2d.PlotDataLayer

class magicclass.ext.vispy.layer2d.Histogram(viewbox: ViewBox, data: np.ndarray, bins: int = 10, face_color=None, edge_color=None, name: str | None = None)[source]

Bases: magicclass.ext.vispy._base.LayerItem

property name
class magicclass.ext.vispy.layer2d.PlotDataLayer[source]

Bases: magicclass.ext.vispy._base.LayerItem

add(points: np.ndarray | Sequence)[source]

Add new points to the plot data item.

property color
property edge_color: numpy.ndarray

Edge color of the data.

property face_color: numpy.ndarray

Face color of the data.

property name: str
property ndata: int
remove(i: int | Sequence[int])[source]

Remove the i-th data.

property xdata: numpy.ndarray
property ydata: numpy.ndarray
class magicclass.ext.vispy.layer2d.Scatter(viewbox: ViewBox, x: ArrayLike, y: ArrayLike = None, face_color=None, edge_color=None, size: float = 7, name: str | None = None, symbol='o')[source]

Bases: magicclass.ext.vispy.layer2d.PlotDataLayer

magicclass.ext.vispy.layer3d module

class magicclass.ext.vispy.layer3d.Image(data, viewbox: ViewBox, contrast_limits: tuple[float, float] | None = None, rendering: str = 'mip', iso_threshold: float | None = None, name: str = '', attenuation: float = 1.0, cmap: str = 'grays', gamma: str = 1.0, interpolation: str = 'linear')[source]

Bases: magicclass.ext.vispy._base.LayerItem, magicclass.fields._group.HasFields

INTERPOLATIONS = ['nearest', 'linear']
RENDERINGS = ['translucent', 'mip', 'minip', 'attenuated_mip', 'additive', 'iso', 'average']
attenuation

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

contrast_limits

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

property data: numpy.ndarray
gamma

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

interpolation

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

iso_threshold

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

property name: str
rendering

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

class magicclass.ext.vispy.layer3d.IsoSurface(data, viewbox: ViewBox, contrast_limits=None, iso_threshold=None, face_color=None, edge_color=None, shading='smooth', name: str | None = None)[source]

Bases: magicclass.ext.vispy.layer3d._SurfaceBase, magicclass.fields._group.HasFields

contrast_limits

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

property data: numpy.ndarray
edge_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

edge_width

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

face_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

iso_threshold

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

shading

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

class magicclass.ext.vispy.layer3d.Surface(data, viewbox: ViewBox, face_color=None, edge_color=None, shading='none', name: str | None = None)[source]

Bases: magicclass.ext.vispy.layer3d._SurfaceBase, magicclass.fields._group.HasFields

property data
edge_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

edge_width

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

face_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

shading

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

magicclass.ext.vispy.layerlist module

class magicclass.ext.vispy.layerlist.LayerList(data=())[source]

Bases: psygnal.containers._evented_list.EventedList[magicclass.ext.vispy._base.LayerItem]

events: ListEvents

magicclass.ext.vispy.plot_api module

magicclass.ext.vispy.plot_api.figure()[source]
magicclass.ext.vispy.plot_api.gca()[source]
magicclass.ext.vispy.plot_api.gcf()[source]
magicclass.ext.vispy.plot_api.imshow(image, cmap=None, vmin=None, vmax=None)[source]
magicclass.ext.vispy.plot_api.plot(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, lw: float = 1, ls: str = '-', symbol=None) VispyPlotCanvas[source]
magicclass.ext.vispy.plot_api.scatter(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, symbol=None) VispyPlotCanvas[source]
magicclass.ext.vispy.plot_api.show()[source]
magicclass.ext.vispy.plot_api.subplot(pos: int)[source]
magicclass.ext.vispy.plot_api.subplot(row: int, col: int, idx: int)

magicclass.ext.vispy.widgets2d module

class magicclass.ext.vispy.widgets2d.Has2DViewBox(viewbox: vispy.scene.widgets.viewbox.ViewBox)[source]

Bases: magicclass.ext.vispy._base.HasViewBox

add_curve(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, lw: float = 1, ls: str = '-', symbol=None)[source]

Add a line plot like plt.plot(x, y).

Parameters
  • x (array-like) --

    X data.

    y : array-like

    Y data.

    face_color: str or array-like, optional

    Face color of plot. Graphic object will be filled with this color.

    edge_color: str or array-like, optional

    Edge color of plot.

    color: str or array-like, optional

    Set face color and edge color at the same time.

  • size (float, default is 7) -- Symbol size.

  • name (str, optional) --

    Object name of the plot item.

    lw: float, default is 1.0

    Line width of edge.

    ls: str, default is "-"

    Line style of edge. One of "-", "--", ":" or "-.".

    symbol: str, optional

    Symbol style. Currently supports circle ("o"), cross ("+", "x"), star ("*"), square ("s", "D") triangle ("^", "<", "v", ">") and others that pyqtgraph supports.

Returns

A plot item of a curve.

Return type

Curve

add_hist(data, bins: int = 10, face_color=None, edge_color=None, color=None, name: str | None = None) Histogram[source]
add_scatter(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, symbol=None)[source]

Add a line plot like plt.plot(x, y).

Parameters
  • x (array-like) --

    X data.

    y : array-like

    Y data.

    face_color: str or array-like, optional

    Face color of plot. Graphic object will be filled with this color.

    edge_color: str or array-like, optional

    Edge color of plot.

    color: str or array-like, optional

    Set face color and edge color at the same time.

  • size (float, default is 7) -- Symbol size.

  • name (str, optional) --

    Object name of the plot item.

    symbol: str, optional

    Symbol style. Currently supports circle ("o"), cross ("+", "x"), star ("*"), square ("s", "D") triangle ("^", "<", "v", ">") and others that pyqtgraph supports.

Returns

A plot item of a curve.

Return type

Curve

property xrange: tuple[float, float]

Range of X dimension.

property yrange: tuple[float, float]

Range of Y dimension.

class magicclass.ext.vispy.widgets2d.ImageItem(viewbox: ViewBox | None = None, lock_contrast_limits: bool = False)[source]

Bases: magicclass.ext.vispy.widgets2d.Has2DViewBox

property cmap
property contrast_limits: tuple[float, float]

Contrast limits of the image.

property image
property title: str

The title string.

property xlabel: str

The x-label string.

property ylabel: str

The x-label string.

class magicclass.ext.vispy.widgets2d.PlotItem(viewbox: vispy.scene.widgets.viewbox.ViewBox)[source]

Bases: magicclass.ext.vispy.widgets2d.Has2DViewBox

property title: str

The title string.

property xlabel: str

The x-label string.

property ylabel: str

The x-label string.

class magicclass.ext.vispy.widgets2d.VispyImageCanvas(**kwargs)[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets2d.ImageItem

A Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.widgets2d.VispyMultiImageCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.widgets2d.VispyMultiPlotCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 2-D plot canvas.

class magicclass.ext.vispy.widgets2d.VispyPlotCanvas(**kwargs)[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets2d.PlotItem

A Vispy based 2-D plot canvas for curve, histogram, bar plot etc.

magicclass.ext.vispy.widgets3d module

class magicclass.ext.vispy.widgets3d.Has3DViewBox(viewbox: vispy.scene.widgets.viewbox.ViewBox)[source]

Bases: magicclass.ext.vispy._base.HasViewBox

A Vispy canvas for 3-D object visualization.

Very similar to napari. This widget can be used independent of napari, or as a mini-viewer of napari.

add_image(data: ArrayLike, *, contrast_limits: tuple[float, float] = None, rendering: str = 'mip', iso_threshold: float | None = None, attenuation: float = 1.0, cmap: str = 'grays', gamma: float = 1.0, interpolation: str = 'linear')[source]
add_isosurface(data: ArrayLike, *, contrast_limits: tuple[float, float] | None = None, iso_threshold: float | None = None, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
add_surface(data: tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike], *, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
property camera

Return the native camera.

property layers

Return the layer list.

class magicclass.ext.vispy.widgets3d.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets3d.Has3DViewBox

A Vispy based 3-D canvas.

class magicclass.ext.vispy.widgets3d.VispyMulti3DCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 3-D canvas.

Module contents

class magicclass.ext.vispy.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets3d.Has3DViewBox

A Vispy based 3-D canvas.

class magicclass.ext.vispy.VispyImageCanvas(**kwargs)[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets2d.ImageItem

A Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.VispyMulti3DCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 3-D canvas.

class magicclass.ext.vispy.VispyMultiImageCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.VispyMultiPlotCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy._base.MultiPlot

A multiple Vispy based 2-D plot canvas.

class magicclass.ext.vispy.VispyPlotCanvas(**kwargs)[source]

Bases: magicclass.widgets.utils.FreeWidget, magicclass.ext.vispy.widgets2d.PlotItem

A Vispy based 2-D plot canvas for curve, histogram, bar plot etc.