spateo.plotting.static.three_d_plot#

Submodules#

Package Contents#

Functions#

acceleration(adata, model[, acceleration_key, ...])

Visualize the torsion result.

curl(adata, model[, curl_key, filename, jupyter, ...])

Visualize the curl result.

curvature(adata, model[, curvature_key, filename, ...])

Visualize the curvature result.

divergence(adata, model[, divergence_key, filename, ...])

Visualize the divergence result.

jacobian(adata, model[, jacobian_key, filename, ...])

Visualize the jacobian result.

torsion(adata, model[, torsion_key, filename, ...])

Visualize the torsion result.

merge_animations([mp4_files, mp4_folder, filename])

Use MoviePy to compose a new animation and play multiple animations together in the new animation.

three_d_animate(models[, stable_model, stable_kwargs, ...])

Animated visualization of 3D reconstruction model.

three_d_multi_plot(model[, key, filename, jupyter, ...])

Multi-view visualization of reconstructed 3D model.

three_d_plot(model[, key, filename, jupyter, ...])

Visualize reconstructed 3D model.

add_legend(plotter, model[, key, colormap, ...])

Add a legend to the plotter.

add_model(plotter, model[, key, colormap, ambient, ...])

Add model(s) to the plotter.

add_num_legend(plotter[, title, title_font_size, ...])

Add a numeric legend (colorbar) to the plotter.

add_outline(plotter, model[, outline_width, ...])

Produce an outline of the full extent for the model.

add_str_legend(plotter, labels, colors, legend_size, ...)

Add a string legend to the plotter.

add_text(plotter, text[, font_family, font_size, ...])

Add text to the plotter.

create_plotter(, background, shape, list, ...)

Create a plotting object to display pyvista/vtk model.

output_plotter(plotter[, filename, view_up, ...])

Output plotter as image, gif file or mp4 file.

save_plotter(plotter, filename)

Save plotter as gltf file, html file, obj file or vtkjs file.

spateo.plotting.static.three_d_plot.acceleration(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], acceleration_key: str = 'acceleration', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, **kwargs)[source]#

Visualize the torsion result.

Parameters
adata

An anndata object contain acceleration values in .obs[acceleration_key].

model

A reconstructed model contains obs_index values.

acceleration_key

The key in .obs that corresponds to the acceleration values in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

**kwargs

Additional parameters that will be passed into the st.pl.feature function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.acceleration(

adata=stage_adata, model=stage_pc, acceleration_key=”acceleration”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.acceleration(

adata=stage_adata, model=[stage_pc, trajectory_model], acceleration_key=”acceleration”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.curl(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], curl_key: str = 'curl', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, **kwargs)[source]#

Visualize the curl result.

Parameters
adata

An anndata object contain curl values in .obs[curl_key].

model

A reconstructed model contains obs_index values.

curl_key

The key in .obs that corresponds to the curl values in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

**kwargs

Additional parameters that will be passed into the st.pl.feature function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.curl(

adata=stage_adata, model=stage_pc, curl_key=”curl”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.curl(

adata=stage_adata, model=[stage_pc, trajectory_model], curl_key=”curl”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.curvature(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], curvature_key: str = 'curvature', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, **kwargs)[source]#

Visualize the curvature result.

Parameters
adata

An anndata object contain curvature values in .obs[curvature_key].

model

A reconstructed model contains obs_index values.

curvature_key

The key in .obs that corresponds to the curvature values in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

**kwargs

Additional parameters that will be passed into the st.pl.feature function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.curvature(

adata=stage_adata, model=stage_pc, curvature_key=”curvature”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.curvature(

adata=stage_adata, model=[stage_pc, trajectory_model], curvature_key=”curvature”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.divergence(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], divergence_key: str = 'divergence', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, **kwargs)[source]#

Visualize the divergence result.

Parameters
adata

An anndata object contain curl values in .obs[divergence_key].

model

A reconstructed model contains obs_index values.

divergence_key

The key in .obs that corresponds to the divergence values in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

**kwargs

Additional parameters that will be passed into the st.pl.feature function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.divergence(

adata=stage_adata, model=stage_pc, divergence_key=”divergence”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.divergence(

adata=stage_adata, model=[stage_pc, trajectory_model], divergence_key=”divergence”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.jacobian(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], jacobian_key: str = 'jacobian', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, off_screen: bool = False, shape: Union[str, list, tuple] = (3, 3), window_size: Optional[tuple] = (512 * 3, 512 * 3), background: str = 'black', colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, **kwargs)[source]#

Visualize the jacobian result.

Parameters
adata

An anndata object contain jacobian matrix in .uns[jacobian_key].

model

A reconstructed model contains obs_index values.

jacobian_key

The key in .uns that corresponds to the jacobian matrix in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

off_screen

Renders off-screen when True. Useful for automated screenshots.

shape

Number of sub-render windows inside the main window. By default, there are nine render window.

  • Specify two across with ``shape``=(2, 1) and a two by two grid with ``shape``=(2, 2).

  • shape Can also accept a string descriptor as shape.

    E.g.: shape="3|1" means 3 plots on the left and 1 on the right, E.g.: shape="4/2" means 4 plots on top and 2 at the bottom.

window_size

Window size in pixels. The default window_size is [512*3, 512*3].

background

The background color of the window.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

show_legend

whether to add a legend to the plotter.

legend_kwargs

A dictionary that will be pass to the add_legend function. By default, it is an empty dictionary and the add_legend function will use the {"legend_size": None, "legend_loc": None,  "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

text

The text to add the rendering.

text_kwargs

A dictionary that will be pass to the add_text function.

By default, it is an empty dictionary and the add_legend function will use the { "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

**kwargs

Additional parameters that will be passed into the st.pl.three_d_multi_plot function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.jacobian(

adata=stage_adata, model=stage_pc, jacobian_key=”jacobian”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.jacobian(

adata=stage_adata, model=[stage_pc, trajectory_model], jacobian_key=”jacobian”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.torsion(adata: anndata.AnnData, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], torsion_key: str = 'torsion', filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, colormap: Optional[Union[str, list]] = 'default_cmap', ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'points', model_size: Union[float, list] = 3.0, **kwargs)[source]#

Visualize the torsion result.

Parameters
adata

An anndata object contain torsion values in .obs[torsion_key].

model

A reconstructed model contains obs_index values.

torsion_key

The key in .obs that corresponds to the torsion values in the anndata object.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

**kwargs

Additional parameters that will be passed into the st.pl.feature function.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

Examples

Visualize only in one model:

st.pl.torsion(

adata=stage_adata, model=stage_pc, torsion_key=”torsion”, jupyter=”static”, model_style=”points”, model_size=3

)

Visualize in multiple model:

st.pl.torsion(

adata=stage_adata, model=[stage_pc, trajectory_model], torsion_key=”torsion”, jupyter=”static”, model_style=[“points”, “wireframe”], model_size=[3, 1]

)

spateo.plotting.static.three_d_plot.merge_animations(mp4_files: Optional[list] = None, mp4_folder: Optional[list] = None, filename: str = 'merged_animation.mp4')[source]#

Use MoviePy to compose a new animation and play multiple animations together in the new animation.

Parameters
mp4_files

A list containing absolute paths to mp4 files that need to be played together.

mp4_folder

Absolute path to the folder containing all mp4 files that need to be played together. If mp4_files is provided, mp4_folder cannot also be provided.

filename

Absolute path to save the newly composed animation.

Examples

st.pl.merge_animations(mp4_files=[“animation1.mp4”, “animation2.mp4”], filename=f”merged_animation.mp4”)

spateo.plotting.static.three_d_plot.three_d_animate(models: Union[List[PolyData or UnstructuredGrid], pyvista.MultiBlock], stable_model: Optional[Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock]] = None, stable_kwargs: Optional[dict] = None, key: Optional[str] = None, filename: str = 'animate.mp4', jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, off_screen: bool = False, window_size: tuple = (512, 512), background: str = 'white', cpo: Union[str, list] = 'iso', colormap: Optional[Union[str, list]] = None, ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'surface', model_size: Union[float, list] = 3.0, show_legend: bool = True, legend_kwargs: Optional[dict] = None, show_outline: bool = False, outline_kwargs: Optional[dict] = None, text: Optional[str] = None, text_kwargs: Optional[dict] = None, framerate: int = 24, plotter_filename: Optional[str] = None)[source]#

Animated visualization of 3D reconstruction model.

Parameters
models

A List of reconstructed models or a MultiBlock.

stable_model

The model that do not change with time in animation.

stable_kwargs

Parameters for plotting stable model. Available stable_kwargs are:

  • 'key'

  • 'ambient'

  • 'opacity'

  • 'model_style'

  • 'model_size'

  • 'background'

  • 'show_legend'

  • 'legend_kwargs'

  • 'show_outline'

  • 'outline_kwargs'

  • 'text'

  • 'text_kwargs'

key

The key under which are the labels.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

off_screen

Renders off-screen when True. Useful for automated screenshots.

window_size

Window size in pixels. The default window_size is [512, 512].

background

The background color of the window.

cpo

Camera position of the active render window. Available cpo are:

  • Iterable containing position, focal_point, and view up.

    E.g.: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)].

  • Iterable containing a view vector.

    E.g.: [-1.0, 2.0, -5.0].

  • A string containing the plane orthogonal to the view direction.

    E.g.: 'xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso'.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

show_legend

whether to add a legend to the plotter.

legend_kwargs

A dictionary that will be pass to the add_legend function. By default, it is an empty dictionary and the add_legend function will use the {"legend_size": None, "legend_loc": None,  "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

show_outline

whether to produce an outline of the full extent for the model.

outline_kwargs

A dictionary that will be pass to the add_outline function.

By default, it is an empty dictionary and the add_legend function will use the {"outline_width": 5.0, "outline_color": "black", "show_labels": True, "font_size": 16, "font_color": "white", "font_family": "arial"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

text

The text to add the rendering.

text_kwargs

A dictionary that will be pass to the add_text function.

By default, it is an empty dictionary and the add_legend function will use the { "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

framerate

Frames per second. Only available when filename ending with .mp4 or .gif.

plotter_filename

The filename of the file where the plotter is saved.

Writer type is inferred from the extension of the filename.

  • Output a gltf file, please enter a filename ending with .gltf.

  • Output a html file, please enter a filename ending with .html.

  • Output an obj file, please enter a filename ending with .obj.

  • Output a vtkjs file, please enter a filename without format.

spateo.plotting.static.three_d_plot.three_d_multi_plot(model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], key: Union[str, list] = None, filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, off_screen: bool = False, shape: Union[str, list, tuple] = None, window_size: Optional[tuple] = None, background: str = 'white', cpo: Union[str, list] = 'iso', colormap: Optional[Union[str, list]] = None, ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'surface', model_size: Union[float, list] = 3.0, show_legend: bool = True, legend_kwargs: Optional[dict] = None, show_outline: bool = False, outline_kwargs: Optional[dict] = None, text: Union[str, list] = None, text_kwargs: Optional[dict] = None, view_up: tuple = (0.5, 0.5, 1), framerate: int = 24, plotter_filename: Optional[str] = None)[source]#

Multi-view visualization of reconstructed 3D model.

Parameters
model

A MultiBlock of reconstructed models or a reconstructed model.

key

The key under which are the labels.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

off_screen

Renders off-screen when True. Useful for automated screenshots.

shape

Number of sub-render windows inside the main window. By default, there is only one render window.

  • Specify two across with ``shape``=(2, 1) and a two by two grid with ``shape``=(2, 2).

  • shape Can also accept a string descriptor as shape.

    E.g.: shape="3|1" means 3 plots on the left and 1 on the right, E.g.: shape="4/2" means 4 plots on top and 2 at the bottom.

window_size

Window size in pixels. The default window_size is [512, 512].

background

The background color of the window.

cpo

Camera position of the active render window. Available cpo are:

  • Iterable containing position, focal_point, and view up.

    E.g.: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)].

  • Iterable containing a view vector.

    E.g.: [-1.0, 2.0, -5.0].

  • A string containing the plane orthogonal to the view direction.

    E.g.: 'xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso'.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

show_legend

whether to add a legend to the plotter.

legend_kwargs

A dictionary that will be pass to the add_legend function. By default, it is an empty dictionary and the add_legend function will use the {"legend_size": None, "legend_loc": None,  "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

show_outline

whether to produce an outline of the full extent for the model.

outline_kwargs

A dictionary that will be pass to the add_outline function.

By default, it is an empty dictionary and the add_legend function will use the {"outline_width": 5.0, "outline_color": "black", "show_labels": True, "font_size": 16, "font_color": "white", "font_family": "arial"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

text

The text to add the rendering.

text_kwargs

A dictionary that will be pass to the add_text function.

By default, it is an empty dictionary and the add_legend function will use the { "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

view_up

The normal to the orbital plane. Only available when filename ending with .mp4 or .gif.

framerate

Frames per second. Only available when filename ending with .mp4 or .gif.

plotter_filename

The filename of the file where the plotter is saved.

Writer type is inferred from the extension of the filename.

  • Output a gltf file, please enter a filename ending with .gltf.

  • Output a html file, please enter a filename ending with .html.

  • Output an obj file, please enter a filename ending with .obj.

  • Output a vtkjs file, please enter a filename without format.

spateo.plotting.static.three_d_plot.three_d_plot(model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], key: Union[str, list] = None, filename: Optional[str] = None, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False, off_screen: bool = False, window_size: tuple = (512, 512), background: str = 'white', cpo: Union[str, list] = 'iso', colormap: Optional[Union[str, list]] = None, ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'surface', model_size: Union[float, list] = 3.0, show_legend: bool = True, legend_kwargs: Optional[dict] = None, show_outline: bool = False, outline_kwargs: Optional[dict] = None, text: Optional[str] = None, text_kwargs: Optional[dict] = None, view_up: tuple = (0.5, 0.5, 1), framerate: int = 24, plotter_filename: Optional[str] = None)[source]#

Visualize reconstructed 3D model.

Parameters
model

A reconstructed model.

key

The key under which are the labels.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

off_screen

Renders off-screen when True. Useful for automated screenshots.

window_size

Window size in pixels. The default window_size is [512, 512].

background

The background color of the window.

cpo

Camera position of the active render window. Available cpo are:

  • Iterable containing position, focal_point, and view up.

    E.g.: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)].

  • Iterable containing a view vector.

    E.g.: [-1.0, 2.0, -5.0].

  • A string containing the plane orthogonal to the view direction.

    E.g.: 'xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso'.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

show_legend

whether to add a legend to the plotter.

legend_kwargs

A dictionary that will be pass to the add_legend function. By default, it is an empty dictionary and the add_legend function will use the {"legend_size": None, "legend_loc": None,  "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

show_outline

whether to produce an outline of the full extent for the model.

outline_kwargs

A dictionary that will be pass to the add_outline function.

By default, it is an empty dictionary and the add_legend function will use the {"outline_width": 5.0, "outline_color": "black", "show_labels": True, "font_size": 16, "font_color": "white", "font_family": "arial"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

text

The text to add the rendering.

text_kwargs

A dictionary that will be pass to the add_text function.

By default, it is an empty dictionary and the add_legend function will use the { "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

view_up

The normal to the orbital plane. Only available when filename ending with .mp4 or .gif.

framerate

Frames per second. Only available when filename ending with .mp4 or .gif.

plotter_filename

The filename of the file where the plotter is saved.

Writer type is inferred from the extension of the filename.

  • Output a gltf file, please enter a filename ending with .gltf.

  • Output a html file, please enter a filename ending with .html.

  • Output an obj file, please enter a filename ending with .obj.

  • Output a vtkjs file, please enter a filename without format.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

spateo.plotting.static.three_d_plot.add_legend(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], key: Optional[Union[str, list]] = None, colormap: Optional[Union[str, list]] = None, legend_size: Optional[Tuple] = None, legend_loc: Union[str, tuple, list] = None, title: Optional[str] = '', title_font_size: Optional[Union[int, float]] = None, label_font_size: Optional[Union[int, float]] = None, font_color: str = 'black', font_family: Literal[times, courier, arial] = 'arial', fmt='%.2e', n_labels: int = 5, vertical: bool = True)[source]#

Add a legend to the plotter.

Parameters
plotter

The plotting object to display pyvista/vtk model.

model

A reconstructed model.

key

The key under which are the legend labels.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

legend_size

The percentage (0 to 1) width and height of the window for the legend.

legend_loc

The location of the legend in the window.

title

Title of the legend. Default ‘’ which is rendered as an empty title.

title_font_size

Sets the size of the title font. Only available when colormap is not None.

label_font_size

Sets the size of the label font. Only available when colormap is not None.

font_color

The color of the font. Only available when colormap is not None.

font_family

The font of the text. Only available when colormap is not None.

Available font_family are:

  • font_family = times

  • font_family = courier

  • font_family = arial

fmt

printf format for labels. Only available when colormap is not None.

n_labels

Number of labels to use for the legend. Only available when colormap is not None.

vertical

Use vertical or horizontal legend. Only available when colormap is not None.

spateo.plotting.static.three_d_plot.add_model(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock, list], key: Union[str, list] = None, colormap: Optional[Union[str, list]] = None, ambient: Union[float, list] = 0.2, opacity: Union[float, list, numpy.ndarray] = 1.0, model_style: Union[Literal[points, surface, wireframe], list] = 'surface', model_size: Union[float, list] = 3.0)[source]#

Add model(s) to the plotter.

Parameters
plotter

The plotting object to display pyvista/vtk model.

model

A reconstructed model.

key

The key under which are the labels.

colormap

Name of the Matplotlib colormap to use when mapping the scalars.

When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.

ambient

When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer.

opacity

Opacity of the model.

If a single float value is given, it will be the global opacity of the model and uniformly applied everywhere, elif a numpy.ndarray with single float values is given, it will be the opacity of each point. - should be between 0 and 1.

A string can also be specified to map the scalars range to a predefined opacity transfer function (options include: ‘linear’, ‘linear_r’, ‘geom’, ‘geom_r’).

model_style

Visualization style of the model. One of the following:

  • model_style = 'surface',

  • model_style = 'wireframe',

  • model_style = 'points'.

model_size

If model_style = 'points', point size of any nodes in the dataset plotted.

If model_style = 'wireframe', thickness of lines.

spateo.plotting.static.three_d_plot.add_num_legend(plotter: pyvista.Plotter, title: Optional[str] = '', title_font_size: Optional[Union[int, float]] = None, label_font_size: Optional[Union[int, float]] = None, font_color: str = 'black', font_family: Literal[times, courier, arial] = 'arial', fmt='%.2e', n_labels: int = 5, legend_size: Union[tuple, list] = (0.1, 0.4), legend_loc: Union[tuple, list] = (0.85, 0.3), vertical: bool = True)[source]#

Add a numeric legend (colorbar) to the plotter.

Parameters
plotter

The plotting object to display pyvista/vtk model.

title

Title of the legend. Default ‘’ which is rendered as an empty title.

title_font_size

Sets the size of the title font.

label_font_size

Sets the size of the label font.

font_color

The color of the font.

font_family

The font of the text. Available font_family are:

  • font_family = times

  • font_family = courier

  • font_family = arial

fmt

printf format for labels.

n_labels

Number of labels to use for the legend.

legend_size

The percentage (0 to 1) width and height of the window for the legend.

legend_loc

The location of the legend in the window.

legend_loc[0]: The percentage (0 to 1) along the windows’s horizontal direction to place the bottom left corner of the legend. legend_loc[1]: The percentage (0 to 1) along the windows’s vertical direction to place the bottom left corner of the legend.

vertical

Use vertical or horizontal legend.

spateo.plotting.static.three_d_plot.add_outline(plotter: pyvista.Plotter, model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock], outline_width: float = 5.0, outline_color: Union[str, tuple] = 'black', show_labels: bool = True, font_size: int = 16, font_color: Union[str, tuple] = 'white', font_family: Literal[times, courier, arial] = 'arial')[source]#

Produce an outline of the full extent for the model. If labels is True, add the length, width and height information of the model to the outline.

Parameters
plotter

The plotting object to display pyvista/vtk model.

model

A reconstructed model.

outline_width

The width of the outline.

outline_color

The color of the outline.

show_labels

Whether to add the length, width and height information of the model to the outline.

font_family

The font family of the text. Available font_family are:

  • font_family = times

  • font_family = courier

  • font_family = arial

font_size

The size of the font.

font_color

The color of the font.

spateo.plotting.static.three_d_plot.add_str_legend(plotter: pyvista.Plotter, labels: numpy.ndarray, colors: numpy.ndarray, legend_size: Optional[Tuple] = None, legend_loc: Literal[upper right, upper left, lower left, lower right, center left, center right, lower center, upper center, center] = 'lower right')[source]#

Add a string legend to the plotter.

Parameters
plotter

The plotting object to display pyvista/vtk model.

labels

Legend labels.

colors

The colors corresponding to the legend labels.

legend_size

The percentage (0 to 1) width and height of the window for the legend.

For example (0.1, 0.1) would make the legend 10% the size of the entire figure window.

If legend_size is None, legend_size will be adjusted adaptively.

legend_loc

The location of the legend in the window. Available legend_loc are:

  • legend_loc = 'upper right'

  • legend_loc = 'upper left'

  • legend_loc = 'lower left'

  • legend_loc = 'lower right'

  • legend_loc = 'center left'

  • legend_loc = 'center right'

  • legend_loc = 'lower center'

  • legend_loc = 'upper center'

  • legend_loc = 'center'

spateo.plotting.static.three_d_plot.add_text(plotter: pyvista.Plotter, text: str, font_family: Literal[times, courier, arial] = 'arial', font_size: Union[int, float] = 12, font_color: Union[str, tuple, list] = 'black', text_loc: Literal[lower_left, lower_right, upper_left, upper_right, lower_edge, upper_edge, right_edge, left_edge] = 'upper_left')[source]#

Add text to the plotter.

Parameters
plotter

The plotting object to display pyvista/vtk model.

text

The text to add the rendering.

font_family

The font family of the text. Available font_family are:

  • font_family = times

  • font_family = courier

  • font_family = arial

font_size

The size of the font.

font_color

The color of the font.

text_loc

The location of the text in the window. Available text_loc are:

  • text_loc = 'lower_left'

  • text_loc = 'lower_right'

  • text_loc = 'upper_left'

  • text_loc = 'upper_right'

  • text_loc = 'lower_edge'

  • text_loc = 'upper_edge'

  • text_loc = 'right_edge'

  • text_loc = 'left_edge'

spateo.plotting.static.three_d_plot.create_plotter(jupyter: bool = False, off_screen: bool = False, window_size: tuple = (512, 512), background: str = 'white', shape: Union[str, list, tuple] = (1, 1)) pyvista.Plotter[source]#

Create a plotting object to display pyvista/vtk model.

Parameters
jupyter

Whether to plot in jupyter notebook.

off_screen

Renders off-screen when True. Useful for automated screenshots.

window_size

Window size in pixels. The default window_size is [1024, 768].

background

The background color of the window.

shape

Number of sub-render windows inside the main window. By default, there is only one render window.

  • Specify two across with ``shape``=(2, 1) and a two by two grid with ``shape``=(2, 2).

  • shape Can also accept a string descriptor as shape.

    E.g.: shape="3|1" means 3 plots on the left and 1 on the right, E.g.: shape="4/2" means 4 plots on top and 2 at the bottom.

Returns

The plotting object to display pyvista/vtk model.

Return type

plotter

spateo.plotting.static.three_d_plot.output_plotter(plotter: pyvista.Plotter, filename: Optional[str] = None, view_up: tuple = (0.5, 0.5, 1), framerate: int = 15, jupyter: Union[bool, Literal[panel, none, pythreejs, static, ipygany]] = False)[source]#

Output plotter as image, gif file or mp4 file.

Parameters
plotter

The plotting object to display pyvista/vtk model.

filename

Filename of output file. Writer type is inferred from the extension of the filename.

  • Output an image file,please enter a filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

  • Output a gif file, please enter a filename ending with .gif.

  • Output a mp4 file, please enter a filename ending with .mp4.

view_up

The normal to the orbital plane. Only available when filename ending with .mp4 or .gif.

framerate

Frames per second. Only available when filename ending with .mp4 or .gif.

jupyter

Whether to plot in jupyter notebook. Available jupyter are:

  • 'none' - Do not display in the notebook.

  • 'pythreejs' - Show a pythreejs widget

  • 'static' - Display a static figure.

  • 'ipygany' - Show an ipygany widget

  • 'panel' - Show a panel widget.

Returns

List of camera position, focal point, and view up.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

img: Numpy array of the last image.

Returned only if filename is None or filename ending with '.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'.

Return type

cpo

spateo.plotting.static.three_d_plot.save_plotter(plotter: pyvista.Plotter, filename: str)[source]#

Save plotter as gltf file, html file, obj file or vtkjs file.

Parameters
plotter

The plotting object to display pyvista/vtk model.

filename

The filename of the file where the plotter is saved.

Writer type is inferred from the extension of the filename.

  • Output a gltf file, please enter a filename ending with .gltf.

  • Output a html file, please enter a filename ending with .html.

  • Output an obj file, please enter a filename ending with .obj.

  • Output a vtkjs file, please enter a filename without format.