spateo.plotting.static.three_d_plot.align_plots =============================================== .. py:module:: spateo.plotting.static.three_d_plot.align_plots Functions --------- .. autoapisummary:: spateo.plotting.static.three_d_plot.align_plots._check_cpos_in_multi_plot spateo.plotting.static.three_d_plot.align_plots.multi_models spateo.plotting.static.three_d_plot.align_plots.deformation Module Contents --------------- .. py:function:: _check_cpos_in_multi_plot(models: List, window_size: Optional[tuple] = None, cpo: Union[str, list] = 'xy') .. py:function:: multi_models(*adata: anndata.AnnData, layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', id_key: str = 'slices', mode: Literal['single', 'overlap', 'both'] = 'single', center_zero: bool = False, filename: Optional[str] = None, jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Union[str, list] = 'xy', shape: Union[str, list, tuple] = None, window_size: Optional[tuple] = None, background: str = 'white', colormap: Union[str, list, dict] = 'red', overlap_cmap: Union[str, list, dict] = 'dodgerblue', alphamap: Union[float, list, dict] = 1.0, overlap_amap: Union[float, list, dict] = 0.5, ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, model_size: Union[float, list] = 3.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, **kwargs) Visualize multiple models separately in one figure. :param \*adata: A list of models[Anndata object]. :param layer: If ``'X'``, uses ``.X``, otherwise uses the representation given by ``.layers[layer]``. :param group_key: The key that stores clustering or annotation information in ``.obs``, a gene name or a list of gene names in ``.var``. :param spatial_key: The key in ``.obsm`` that corresponds to the spatial coordinate of each bucket. :param id_key: The key in ``.obs`` that corresponds to the model id of each bucket. :param mode: Three modes of visualization. Available ``mode`` are: * ``'single'`` - Visualize each model individually. * ``'overlap'`` - Simultaneously visualize two models aligned front to back in one subplot. * ``'both'`` - Simultaneously visualize both types above. :param center_zero: Whether to move the center point of the model to the (0, 0, 0). :param 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'``. When ``jupyter=False``, if you want to save '.png' file, please ensure ``off_screen=True``. :param 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. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param 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'.`` :param 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.`` :param window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :param colormap: Colors to use for plotting pc. The default colormap is ``'dodgerblue'``. :param overlap_cmap: Colors to use for plotting overlapped pc. The default colormap is ``'red'``. :param alphamap: The opacity of the colors to use for plotting pc. The default alphamap is ``1.0``. :param overlap_amap: The opacity of the colors to use for plotting overlapped pc. The default alphamap is ``.5``. :param 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. :param 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'). :param model_size: The point size of any nodes in the dataset plotted. :param show_axes: Whether to add a camera orientation widget to the active renderer. :param show_legend: whether to add a legend to the plotter. :param 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. :param text: The text to add the rendering. :param 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. :param \*\*kwargs: Additional parameters that will be passed to ``three_d_multi_plot`` function. .. py:function:: deformation(*adata: anndata.AnnData, deformed_grid: Union[pyvista.PolyData, List[pyvista.PolyData]], layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', id_key: str = 'slices', deformation_key: Optional[str] = 'deformation', center_zero: bool = False, show_model: bool = True, filename: Optional[str] = None, jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Union[str, list] = 'xy', shape: Union[str, list, tuple] = None, window_size: Optional[tuple] = (1024, 756), background: str = 'white', model_color: Union[str, list] = 'red', model_alpha: Union[float, list, dict] = 1, colormap: Union[str, list, dict] = 'black', alphamap: Union[float, list, dict] = 1.0, ambient: Union[float, list] = 0.2, opacity: Union[float, numpy.ndarray, list] = 1.0, grid_size: Union[float, list] = 2.0, model_size: Union[float, list] = 3.0, show_axes: bool = True, show_legend: bool = False, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, **kwargs)