spateo.plotting.static.three_d_plot.backbone_plots
#
Module Contents#
Functions#
|
Visualize constructed 3D backbone model. |
- spateo.plotting.static.three_d_plot.backbone_plots.backbone(backbone_model: pyvista.PolyData, backbone_key: str = 'backbone', backbone_model_size: float | int = 8, backbone_colormap: str | None = None, backbone_ambient: float | list = 0.2, backbone_opacity: float | numpy.ndarray | list = 1.0, nodes_key: str | None = 'nodes', nodes_label_size: float | int = 18, bg_model: pyvista.PolyData | pyvista.UnstructuredGrid | pyvista.MultiBlock | None = None, bg_key: str | list | None = None, bg_model_style: Literal[points, surface, wireframe] | list = 'points', bg_model_size: float | list = 10, bg_colormap: str | list | None = None, bg_ambient: float | list = 0.2, bg_opacity: float | numpy.ndarray | list = 0.6, show_axes: bool = True, show_legend: bool = True, legend_kwargs: dict | None = None, filename: str | None = None, jupyter: bool | Literal[none, static, trame] = False, off_screen: bool = False, window_size: tuple = (2048, 2048), background: str = 'white', cpo: str | list = 'iso', **kwargs)[source]#
Visualize constructed 3D backbone model.
- Parameters:
- backbone_model
The constructed backbone model.
- backbone_key
Any point_data names or cell_data names to be used for coloring
backbone_model
.- backbone_model_size
The thickness of backbone.
- backbone_colormap
Name of the Matplotlib colormap to use when mapping the scalars of
backbone_model
.When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.
- backbone_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.
- backbone_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’).
- nodes_key
The key that corresponds to the coordinates of the nodes in the backbone.
- nodes_label_size
Sets the size of the title font.
- bg_model
The background model used to construct backbone model.
- bg_key
Any point_data names or cell_data names to be used for coloring
bg_model
.- bg_model_style
Visualization style of
bg_model
. One of the following:bg_model_style = 'surface'
,bg_model_style = 'wireframe'
,bg_model_style = 'points'
.
- bg_model_size
If
bg_model_style = 'points'
, point size of any nodes in the dataset plotted.If
bg_model_style = 'wireframe'
, thickness of lines.- bg_colormap
Name of the Matplotlib colormap to use when mapping the scalars of
bg_model
.When the colormap is None, use {key}_rgba to map the scalars, otherwise use the colormap to map scalars.
- bg_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.
- bg_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’).
- show_axes
Whether to add a camera orientation widget to the active renderer.
- show_legend
whether to add a legend of
bg_model
to the plotter.- legend_kwargs
A dictionary that will be pass to the
add_legend
function. By default, it is an empty dictionary and theadd_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.- 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'
. Whenjupyter=False
, if you want to save ‘.png’ file, please ensureoff_screen=True
.
- jupyter
Whether to plot in jupyter notebook. Available
jupyter
are:'none'
- Do not display in the notebook.'trame'
- Show a trame widget'static'
- Display a static figure.
- 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'.
- **kwargs
Additional parameters that will be passed to
.add_point_labels
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