magicclass.ext.vispy package

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.PlotDataLayer[source]

Bases: magicclass.ext.vispy._base.LayerItem

add(points: np.ndarray | Sequence, **kwargs)[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.layers3d module

class magicclass.ext.vispy.layers3d.Image(data, viewbox: vispy.scene.widgets.viewbox.ViewBox, contrast_limits=None, rendering='mip', iso_threshold=None, attenuation=1.0, cmap='grays', gamma=1.0, interpolation='linear')[source]

Bases: magicclass.ext.vispy._base.LayerItem

property attenuation: float
property contrast_limits: tuple[float, float]
property data: numpy.ndarray
property gamma: float
property interpolation: float
property iso_threshold: float
property rendering: str
class magicclass.ext.vispy.layers3d.IsoSurface(data, viewbox: vispy.scene.widgets.viewbox.ViewBox, contrast_limits=None, iso_threshold=None, face_color=None, edge_color=None, shading='smooth')[source]

Bases: magicclass.ext.vispy.layers3d._SurfaceBase

property contrast_limits: tuple[float, float]
property data: numpy.ndarray
property iso_threshold: float
class magicclass.ext.vispy.layers3d.Surface(data, viewbox: vispy.scene.widgets.viewbox.ViewBox, face_color=None, edge_color=None, shading='none')[source]

Bases: magicclass.ext.vispy.layers3d._SurfaceBase

property data
property face_color: numpy.ndarray

magicclass.ext.vispy.widgets2d module

class magicclass.ext.vispy.widgets2d.HasViewBox(grid_pos: tuple[int, int] = (0, 0), _scene=None, _row=0, _col=0)[source]

Bases: magicclass.widgets.utils.FreeWidget

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_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 layers
property xrange: tuple[float, float]
property yrange: tuple[float, float]
class magicclass.ext.vispy.widgets2d.ImageItem(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.HasViewBox

property cmap
property image
class magicclass.ext.vispy.widgets2d.PlotItem(grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.HasViewBox

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(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.ImageItem

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

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

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

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.widgets2d.VispyPlotCanvas(grid_pos=(0, 0), _scene=None)[source]

Bases: 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.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

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.

Module contents

class magicclass.ext.vispy.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

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.VispyImageCanvas(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.ImageItem

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

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

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

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.VispyPlotCanvas(grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.PlotItem

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