spateo.plotting.static ====================== .. py:module:: spateo.plotting.static .. autoapi-nested-parse:: Spatiotemporal modeling of spatial transcriptomics Subpackages ----------- .. toctree:: :maxdepth: 1 /autoapi/spateo/plotting/static/three_d_plot/index Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/spateo/plotting/static/agg/index /autoapi/spateo/plotting/static/align/index /autoapi/spateo/plotting/static/bbs/index /autoapi/spateo/plotting/static/colorlabel/index /autoapi/spateo/plotting/static/contour/index /autoapi/spateo/plotting/static/dotplot/index /autoapi/spateo/plotting/static/geo/index /autoapi/spateo/plotting/static/glm/index /autoapi/spateo/plotting/static/interactions/index /autoapi/spateo/plotting/static/lisa/index /autoapi/spateo/plotting/static/networks/index /autoapi/spateo/plotting/static/polarity/index /autoapi/spateo/plotting/static/position/index /autoapi/spateo/plotting/static/scatters/index /autoapi/spateo/plotting/static/space/index /autoapi/spateo/plotting/static/utils/index Functions --------- .. autoapisummary:: spateo.plotting.static.box_qc_regions spateo.plotting.static.imshow spateo.plotting.static.qc_regions spateo.plotting.static.overlay_slices_2d spateo.plotting.static.slices_2d spateo.plotting.static.delaunay spateo.plotting.static.polygon spateo.plotting.static.color_label spateo.plotting.static.spatial_domains spateo.plotting.static.dotplot spateo.plotting.static.geo spateo.plotting.static.glm_fit spateo.plotting.static.glm_heatmap spateo.plotting.static.ligrec spateo.plotting.static.plot_connections spateo.plotting.static.lisa spateo.plotting.static.lisa_quantiles spateo.plotting.static.polarity spateo.plotting.static.scatters spateo.plotting.static.space spateo.plotting.static.acceleration spateo.plotting.static.backbone spateo.plotting.static.curl spateo.plotting.static.curvature spateo.plotting.static.deformation spateo.plotting.static.divergence spateo.plotting.static.jacobian spateo.plotting.static.merge_animations spateo.plotting.static.multi_models spateo.plotting.static.pairwise_iteration spateo.plotting.static.pairwise_iteration_panel spateo.plotting.static.pairwise_mapping spateo.plotting.static.pi_heatmap spateo.plotting.static.three_d_animate spateo.plotting.static.three_d_multi_plot spateo.plotting.static.three_d_plot spateo.plotting.static.torsion Package Contents ---------------- .. py:function:: box_qc_regions(adata: anndata.AnnData, layer: str = SKM.X_LAYER, use_scale: bool = True, box_kwargs: Optional[Dict] = None, ax: Optional[matplotlib.axes.Axes] = None, background: Optional[str] = None, save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None, **kwargs) Indicate selected QC regions with boxes on the full tissue. :param adata: Input Anndata :param layer: Layer to display :param use_scale: Whether or not to plot in physical units. Only valid when appropriate scale keys are present in .uns :param box_kwargs: Keyword arguments to pass to :func:`patches.Rectangle`. By default, the boxes will be transparent with red outlines of 1 point thickness. :param ax: Axes to plot. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs. :param \*\*kwargs: Additional keyword arguments are all passed to :func:`imshow`. .. py:function:: imshow(adata: anndata.AnnData, layer: str = SKM.X_LAYER, ax: Optional[matplotlib.axes.Axes] = None, show_cbar: bool = False, use_scale: bool = True, absolute: bool = False, labels: bool = False, downscale: float = 1.0, downscale_interpolation: Optional[int] = None, background: Optional[str] = None, save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None, **kwargs) -> Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]] Display raw data within an AnnData. :param adata: Anndata containing aggregated UMI counts. :param layer: Layer to display. Defaults to X. :param ax: Axes to plot. :param show_cbar: Whether or not to show a colorbar next to the plot. :param use_scale: Whether or not to plot in physical units. Only valid when appropriate scale keys are present in .uns :param absolute: Whether to set the axes to be in absolute coordinates. By default, relative coordinates are used (i.e. the axes start at zero). :param labels: Whether the input data contains labels, encoded as positive integers. :param downscale: Downscale image by this amount for faster plotting. :param downscale_interpolation: Use this CV2 interpolation method when downscaling. By default, bilinear interpolation is used when `labels=True` and nearest neighbor interpolation when `labels=False`. Available options are located here: https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121 Only has an effect when `downscale` < 1. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs. :param \*\*kwargs: Additional keyword arguments are all passed to :func:`imshow`. :returns: The figure and axis if `ax` is not provided. .. py:function:: qc_regions(adata: anndata.AnnData, layer: str = SKM.X_LAYER, axes: Optional[numpy.ndarray] = None, ncols: int = 1, background: Optional[str] = None, save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None, **kwargs) -> Optional[Tuple[matplotlib.figure.Figure, numpy.ndarray]] Display QC regions. :param adata: Input Anndata :param layer: Layer to display :param axes: Numpy array (possibly 2D) of Matplotlib axes to plot each region. This option is useful when trying to overlay multiple layers together. :param ncols: Number of columns when displaying multiple panels. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs. :param \*\*kwargs: Additional keyword arguments are all passed to :func:`imshow`. :returns: The figure and axes if `axes` is not provided. .. py:function:: overlay_slices_2d(slices: Union[anndata.AnnData, List[anndata.AnnData]], slices_key: Optional[Union[bool, str]] = None, label_key: Optional[str] = None, overlay_type: Literal['forward', 'backward', 'both'] = 'both', spatial_key: str = 'spatial', point_size: Optional[float] = None, n_sampling: int = -1, palette: Optional[dict] = None, ncols: int = 4, title: str = '', title_kwargs: Optional[dict] = None, show_legend: bool = True, legend_kwargs: Optional[dict] = None, axis_off: bool = False, axis_kwargs: Optional[dict] = None, ticks_off: bool = True, x_min=None, x_max=None, y_min=None, y_max=None, height: float = 2, alpha: float = 1.0, cmap='tab20', center_coordinate: bool = False, gridspec_kws: Optional[dict] = None, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[dict] = None, **kwargs) .. py:function:: slices_2d(slices: Union[anndata.AnnData, List[anndata.AnnData]], slices_key: Optional[Union[bool, str]] = None, label_key: Optional[str] = None, label_type: Optional[str] = None, spatial_key: str = 'spatial', point_size: Optional[float] = None, n_sampling: int = -1, palette: Optional[dict] = None, ncols: int = 4, title: str = '', title_kwargs: Optional[dict] = None, show_legend: bool = True, legend_kwargs: Optional[dict] = None, axis_off: bool = False, axis_kwargs: Optional[dict] = None, ticks_off: bool = True, x_min=None, x_max=None, y_min=None, y_max=None, height: float = 2, alpha: float = 1.0, cmap='tab20', center_coordinate: bool = False, gridspec_kws: Optional[dict] = None, return_palette: bool = False, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[dict] = None, **kwargs) .. py:function:: delaunay(edge_points, figsize: Union[Tuple, List] = (10, 10), pc: str = '#f16824', title: Optional[str] = None, fig: Optional[matplotlib.figure.Figure] = None, ax: Optional[matplotlib.axes.Axes] = None, background: Optional[str] = None, save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None) Plot the Delaunay triangulation result. :param edge_points: :param figsize: The size of the figure :param fc: The color of the scatter points. :param title: The title of the figure. :param fig: The matplotlib.figure figure object of the figure. :param ax: The matplotlib.axes._subplots AxesSubplot object of the figure. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs. :returns: The matplotlib.figure figure object of the figure. ax: The matplotlib.axes._subplots AxesSubplot object of the figure. :rtype: fig .. py:function:: polygon(concave_hull: Union[shapely.geometry.MultiPolygon, shapely.geometry.Polygon], figsize: Union[Tuple, List] = (10, 10), margin: float = 0.3, fc: str = '#999999', ec: str = '#000000', fig: Optional[matplotlib.figure.Figure] = None, ax: Optional[matplotlib.axes.Axes] = None, background: Optional[str] = None, save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None) Plot the polygon identified by the alpha hull method. :param concave_hull: The identified polygon (or multi-polygon) returned from the alpha_shape method or other methods. :param figsize: The size of the figure :param margin: The margin of the figure Axes. :param fc: The facecolor of the PolygonPatch. :param ec: The edgecolor of the PolygonPatch. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs. :returns: The matplotlib.figure figure object of the figure. ax: The matplotlib.axes._subplots AxesSubplot object of the figure. :rtype: fig .. py:function:: color_label(adata: anndata.AnnData, basis='contour', color_key: Optional[list] = None, dpi: int = 100, boundary_width: float = 0.2, boundary_color='black', figsize=(6, 6), aspect: str = 'equal', *args, **kwargs) Color the segmented cells with different colors. :param adata: ~anndata.AnnData An Annodata object. :param basis: str The key to the column in the adata.obs, from which the contour of the cell segmentation will be generated. :param color_key: list List of colors. If the number of labels exceeds the number of colors, then the colors are cycled. :param dpi: `float`, (default: 100.0) The resolution of the figure in dots-per-inch. Dots per inches (dpi) determines how many pixels the figure comprises. dpi is different from ppi or points per inches. Note that most elements like lines, markers, texts have a size given in points so you can convert the points to inches. Matplotlib figures use Points per inch (ppi) of 72. A line with thickness 1 point will be 1./72. inch wide. A text with fontsize 12 points will be 12./72. inch height. Of course if you change the figure size in inches, points will not change, so a larger figure in inches still has the same size of the elements.Changing the figure size is thus like taking a piece of paper of a different size. Doing so, would of course not change the width of the line drawn with the same pen. On the other hand, changing the dpi scales those elements. At 72 dpi, a line of 1 point size is one pixel strong. At 144 dpi, this line is 2 pixels strong. A larger dpi will therefore act like a magnifying glass. All elements are scaled by the magnifying power of the lens. see more details at answer 2 by @ImportanceOfBeingErnest: https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size :param boundary_width: `float`, (default: 0.2) The line width of boundary. :param boundary_color: (default: "black") The color value of boundary. :param figsize: `tuple` The size of the figure in inches. :param aspect: `str` Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit. In physical spatial plot, the default is 'equal'. See more details at: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_aspect.html .. py:function:: spatial_domains(adata: anndata.AnnData, bin_size: Optional[int] = None, spatial_key: str = 'spatial', label_key: str = 'cluster_img_label', plot_size=(3, 3), save_img='spatial_domains.png') Generate an image with contours of each spatial domains. :param adata: The adata object used to create the image. :param bin_size: The size of the binning. Default to None. :param spatial_key: The key name of the spatial coordinates. Default to "spatial". :param label_key: The key name of the image label values. Default to "cluster_img_label". :param plot_size: figsize for showing the image. :param save_img: path to saving image file. .. py:function:: dotplot(adata: anndata.AnnData, var_names: Sequence[str], cat_key: Union[str, Sequence[str]], num_categories: int = 7, cell_cell_dp: bool = False, delta: Union[None, float] = None, minn: Union[None, float] = None, alpha: Union[None, float] = None, prescale_adata: bool = False, expression_cutoff: float = 0.0, mean_only_expressed: bool = False, cmap: str = 'Reds', dot_max: float = Dotplot.default_dot_max, dot_min: float = Dotplot.default_dot_min, standard_scale: Literal['var', 'group'] = None, smallest_dot: float = Dotplot.default_smallest_dot, largest_dot: float = Dotplot.default_largest_dot, title: str = None, colorbar_title: str = Dotplot.default_color_legend_title, size_title: str = Dotplot.default_size_legend_title, figsize: Union[None, Tuple[float, float]] = None, dendrogram: Union[bool, str] = False, gene_symbols_key: Union[None, str] = None, var_group_positions: Union[None, Sequence[Tuple[int, int]]] = None, var_group_labels: Union[None, Sequence[str]] = None, var_group_rotation: Union[None, float] = None, layer: Union[None, str] = None, swap_axes: bool = False, dot_color_df: Union[None, pandas.DataFrame] = None, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'save', save_kwargs: dict = {}, ax: Union[None, matplotlib.axes.Axes] = None, vmin: Union[None, float] = None, vmax: Union[None, float] = None, vcenter: Union[None, float] = None, norm: Union[None, matplotlib.colors.Normalize] = None, **kwargs) Makes a dot plot of the expression values of `var_names`. For each var_name and each `groupby` category a dot is plotted. Each dot represents two values: mean expression within each category (visualized by color) and fraction of cells expressing the `var_name` in the category (visualized by the size of the dot). If `groupby` is not given, the dotplot assumes that all data belongs to a single category. :param adata: object of class `anndata.AnnData` :param var_names: Should be a subset of adata.var_names :param cat_key: The key(s) in .obs of the grouping to consider. Should be a categorical observation; if not, will be subdivided into 'num_categories'. :param num_categories: Only used if groupby observation is not categorical. This value determines the number of groups into which the groupby observation should be subdivided. :param cell_cell_dp: Set True to initialize specialized cell-cell dotplot instead of gene expression dotplot :param delta: Only used if 'cell_cell_dp' is True- distance between the largest value to consider and the smallest value to consider (see 'minn' parameter below) :param minn: Only used if 'cell_cell_dp' is True- for the dot size legend, sets the value corresponding to the smallest dot on the legend :param alpha: Only used if 'cell_cell_dp' is True- significance threshold. If given, all elements w/ p-values <= 'alpha' will be marked by rings instead of dots. :param prescale_adata: Set True to indicate that AnnData object should be scaled- if so, will use 'delta' and 'minn' to do so. If False, will proceed as though adata has already been processed as needed. :param expression_cutoff: Used for binarizing feature expression- feature is considered to be expressed only if the expression value is greater than this threshold :param mean_only_expressed: If True, gene expression is averaged only over the cells expressing the given features :param cmap: Name of Matplotlib color map to use :param dot_max: If none, the maximum dot size is set to the maximum fraction value found (e.g. 0.6). If given, the value should be a number between 0 and 1. All fractions larger than dot_max are clipped to this value. :param dot_min: If none, the minimum dot size is set to 0. If given, the value should be a number between 0 and 1. All fractions smaller than dot_min are clipped to this value. :param standard_scale: Whether or not to standardize that dimension between 0 and 1, meaning for each variable or group, subtract the minimum and divide each by its maximum. 'val' or 'group' is used to specify whether this should be done over variables or groups. :param smallest_dot: If None, the smallest dot has size 0. All expression fractions with `dot_min` are plotted with this size. :param largest_dot: If None, the largest dot has size 200. All expression fractions with `dot_max` are plotted with this size. :param title: Title for the entire plot :param colorbar_title: Title for the color legend. If None will use generic default title :param size_title: Title for the dot size legend. If None will use generic default title :param figsize: Sets width and height of figure window :param dendrogram: If True, adds dendrogram to plot. Will do the same thing if string is given here, but will recompute dendrogram and save using this argument to set key in .uns. :param gene_symbols_key: Key in .var containing gene symbols :param var_group_positions: Each item in the list should contain the start and end position that the bracket should cover. Eg. [(0, 4), (5, 8)] means that there are two brackets, one for the var_names in positions 0-4 and other for positions 5-8 :param var_group_labels: List of group labels for the variable names (e.g. can group var_names in positions 0-4 as being "group A") :param var_group_rotation: Rotation in degrees of the variable name labels. If not given, small labels (<4 characters) are not rotated, but otherwise labels are rotated 90 degrees. :param layer: Key in .layers specifying layer to use. If not given, will use .X. :param swap_axes: Set True to switch what is plotted on the x- and y-axes :param dot_color_df: Pre-prepared dataframe with features as indices, categories as columns, and indices corresponding to color intensities :param save_show_or_return: Options: "save", "show", "return", "both", "all" - "both" for save and show :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. But to change any of these parameters, this dictionary can be used to do so. :param ax: Pre-initialized axis object to plot on :param vmin: The data value that defines 0.0 in the normalization. Defaults to the min value of the dataset. :param vmax: The data value that defines 1.0 in the normalization. Defaults to the the max value of the dataset. :param vcenter: The data value that defines 0.5 in the normalization :param norm: Optional already-initialized normalizing object that scales data, typically into the interval [0, 1], for the purposes of mapping to color intensities for plotting. Do not pass both 'norm' and 'vmin'/'vmax', etc. :param kwargs: Additional keyword arguments passed to :func:`matplotlib.pyplot.scatter` :returns: Instantiated Figure object- only if 'return' is True axes: Instantiated Axes object- only if 'return' is True :rtype: fig .. py:function:: geo(adata: anndata.AnnData, basis: str = 'contour', color: Union[list, str, None] = None, genes: Union[list, None] = [], gene_cmaps: Optional[str] = None, dpi: int = 100, alpha: float = 0.8, boundary_width: float = 0.2, boundary_color='black', stack_genes: bool = False, stack_genes_threshold: float = 0.01, stack_colors_legend_size: int = 10, figsize: Tuple[float, float] = (6, 6), aspect: str = 'equal', slices: Optional[int] = None, img_layers: Optional[int] = None, *args, **kwargs) Geometry plot for physical coordinates of each cell. :param adata: an Annodata object that contain the physical coordinates for each bin/cell, etc. :param basis: The key to the column in adata.obs from which the contour of the cell segmentation will be generated. :param color: Any or any list of column names or gene name, etc. that will be used for coloring cells. If `color` is not None, stack_genes will be disabled automatically because `color` can contain non numerical values. :param genes: The gene list that will be used to plot the gene expression on the same scatter plot. Each gene will have a different color. Can be a single gene name string and we will convert it to a list. :param gene_cmaps: The colormap used to stack different genes in a single plot. :param dpi: The resolution of the figure in dots-per-inch. Dots per inches (dpi) determines how many pixels the figure comprises. dpi is different from ppi or points per inches. Note that most elements like lines, markers, texts have a size given in points so you can convert the points to inches. Matplotlib figures use Points per inch (ppi) of 72. A line with thickness 1 point will be 1./72. inch wide. A text with fontsize 12 points will be 12./72. inch height. Of course if you change the figure size in inches, points will not change, so a larger figure in inches still has the same size of the elements.Changing the figure size is thus like taking a piece of paper of a different size. Doing so, would of course not change the width of the line drawn with the same pen. On the other hand, changing the dpi scales those elements. At 72 dpi, a line of 1 point size is one pixel strong. At 144 dpi, this line is 2 pixels strong. A larger dpi will therefore act like a magnifying glass. All elements are scaled by the magnifying power of the lens. see more details at answer 2 by @ImportanceOfBeingErnest: https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size :param alpha: The alpha value of the cells. :param boundary_width: The line width of boundary. :param boundary_color: The color value of boundary. :param stack_genes: whether to show all gene plots on the same plot :param stack_genes_threshold: lower bound of gene values that will be drawn on the plot. :param stack_colors_legend_size: control the size of legend when stacking genes :param figuresize: size of the figure. :param aspect: Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit. In physical spatial plot, the default is 'equal'. See more details at: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_aspect.html :param slices: The index to the tissue slice, will used in adata.uns["spatial"][slices]. :param img_layers: The index to the (staining) image of a tissue slice, will be used in adata.uns["spatial"][slices]["images"]. :rtype: plots gene or cell feature of the adata object on the physical spatial coordinates. .. py:function:: glm_fit(adata: anndata.AnnData, genes: Optional[Union[str, list]] = None, feature_x: str = None, feature_y: str = 'expression', glm_key: str = 'glm_degs', remove_zero: bool = False, color_key: Optional[str] = None, color_key_cmap: Optional[str] = 'vlag', point_size: float = 14, point_color: Union[str, numpy.ndarray, list] = 'skyblue', line_size: float = 2, line_color: str = 'black', ax_size: Union[tuple, list] = (6, 4), background_color: str = 'white', ncols: int = 4, show_point: bool = True, show_line: bool = True, show_legend: bool = True, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[dict] = None, **kwargs) Plot the glm_degs result in a scatterplot. :param adata: An Anndata object contain glm_degs result in ``.uns[glm_key]``. :param genes: A gene name or a list of genes that will be used to plot. :param feature_x: The key in ``.uns[glm_key]['correlation'][gene]`` that corresponds to the independent variables, such as ``'torsion'``, etc. :param feature_y: The key in ``.uns[glm_key]['correlation'][gene]`` that corresponds to the dependent variables, such as ``'expression'``, etc. :param glm_key: The key in ``.uns`` that corresponds to the glm_degs result. :param remove_zero: Whether to remove the data equal to 0 saved in ``.uns[glm_key]['correlation'][gene][feature_y]``. :param color_key: This can either be an explicit dict mapping labels to colors (as strings of form ‘#RRGGBB’), or an array like object providing one color for each distinct category being provided in labels. :param color_key_cmap: The name of a matplotlib colormap to use for categorical coloring. :param point_size: The scale of the feature_y point size. :param point_color: The color of the feature_y point. :param line_size: The scale of the fitted line width. :param line_color: The color of the fitted line. :param ax_size: The width and height of each ax. :param background_color: The background color of the figure. :param ncols: Number of columns for the figure. :param show_point: Whether to show the scatter plot. :param show_line: Whether to show the line plot. :param show_legend: Whether to show the legend. :param save_show_or_return: If ``'both'``, it will save and plot the figure at the same time. If ``'all'``, the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will be passed to the save_fig function. By default, it is an empty dictionary and the save_fig function will use the ``{"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True}`` 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 into the ``seaborn.scatterplot`` function. .. py:function:: glm_heatmap(adata: anndata.AnnData, genes: Optional[Union[str, list]] = None, feature_x: str = None, feature_y: str = 'expression', glm_key: str = 'glm_degs', lowess_smooth: bool = True, frac: float = 0.2, robust: bool = True, colormap: str = 'vlag', figsize: tuple = (6, 6), background_color: str = 'white', show_legend: bool = True, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[dict] = None, **kwargs) Plot the glm_degs result in a heatmap. :param adata: An Anndata object contain glm_degs result in ``.uns[glm_key]``. :param genes: A gene name or a list of genes that will be used to plot. :param feature_x: The key in ``.uns[glm_key]['correlation'][gene]`` that corresponds to the independent variables, such as ``'torsion'``, etc. :param feature_y: The key in ``.uns[glm_key]['correlation'][gene]`` that corresponds to the dependent variables, such as ``'expression'``, etc. :param glm_key: The key in ``.uns`` that corresponds to the glm_degs result. :param lowess_smooth: If True, use statsmodels to estimate a nonparametric lowess model (locally weighted linear regression). :param frac: Between 0 and 1. The fraction of the data used when estimating each y-value. :param robust: If True and vmin or vmax are absent, the colormap range is computed with robust quantiles instead of the extreme values. :param colormap: The name of a matplotlib colormap. :param figsize: The width and height of figure. :param background_color: The background color of the figure. :param show_legend: Whether to show the legend. :param save_show_or_return: If ``'both'``, it will save and plot the figure at the same time. If ``'all'``, the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will be passed to the save_fig function. By default, it is an empty dictionary and the save_fig function will use the ``{"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True}`` 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 into the ``seaborn.heatmap`` function. .. py:function:: ligrec(adata: anndata.AnnData, dict_key: str, source_groups: Union[None, str, List[str]] = None, target_groups: Union[None, str, List[str]] = None, means_range: Tuple[float, float] = (-np.inf, np.inf), pvalue_threshold: float = 1.0, remove_empty_interactions: bool = True, remove_nonsig_interactions: bool = False, dendrogram: Union[None, str] = None, alpha: float = 0.001, swap_axes: bool = False, title: Union[None, str] = None, figsize: Union[None, Tuple[float, float]] = None, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[ligrec.dict] = {}, **kwargs) Dotplot for visualizing results of ligand-receptor interaction analysis For each L:R pair on the dotplot, molecule 1 is sent from the cluster(s) labeled on the top of the plot (or on the right, if 'swap_axes' is True), whereas molecule 2 is the receptor on the cluster(s) labeled on the bottom. :param adata: Object of :class `anndata.AnnData` :param dict_key: Key in .uns to dictionary containing cell-cell communication information. Should contain keys labeled "means" and "pvalues", with values being dataframes for the mean cell type-cell type L:R product and significance values. :param source_groups: Source interaction clusters. If `None`, select all clusters. :param target_groups: Target interaction clusters. If `None`, select all clusters. :param means_range: Only show interactions whose means are within this **closed** interval :param pvalue_threshold: Only show interactions with p-value <= `pvalue_threshold` :param remove_empty_interactions: Remove rows and columns that contain NaN values :param remove_nonsig_interactions: Remove rows and columns that only contain interactions that are larger than `alpha` :param dendrogram: How to cluster based on the p-values. Valid options are: - None (no input) - do not perform clustering. - `'interacting_molecules'` - cluster the interacting molecules. - `'interacting_clusters'` - cluster the interacting clusters. - `'both'` - cluster both rows and columns. Note that in this case, the dendrogram is not shown. :param alpha: Significance threshold. All elements with p-values <= `alpha` will be marked by tori instead of dots. :param swap_axes: Whether to show the cluster combinations as rows and the interacting pairs as columns :param title: Title of the plot :param figsize: The width and height of a figure :param save_show_or_return: Options: "save", "show", "return", "both", "all" - "both" for save and show :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. But to change any of these parameters, this dictionary can be used to do so. :param kwargs: Keyword arguments for :func `style` or :func `legend` of :class `Dotplot` .. py:function:: plot_connections(adata: anndata.AnnData, cat_key: str, spatial_key: str = 'spatial', n_spatial_neighbors: Union[None, int] = 6, spatial_weights_matrix: Union[None, scipy.sparse.csr_matrix, numpy.ndarray] = None, expr_weights_matrix: Union[None, scipy.sparse.csr_matrix, numpy.ndarray] = None, reverse_expr_plot_orientation: bool = True, ax: Union[None, matplotlib.axes.Axes] = None, figsize: tuple = (3, 3), zero_self_connections: bool = True, normalize_by_self_connections: bool = False, shapes_style: bool = True, label_outline: bool = False, max_scale: float = 0.46, colormap: Union[str, dict, matplotlib.colormap] = 'Spectral', title_str: Union[None, str] = None, title_fontsize: Union[None, float] = None, label_fontsize: Union[None, float] = None, save_show_or_return: Literal['save', 'show', 'return', 'both', 'all'] = 'show', save_kwargs: Optional[dict] = {}) Plot spatial_connections between labels- visualization of how closely labels are colocalized :param adata: AnnData object :param cat_key: Key in .obs containing categorical grouping labels. Colocalization will be assessed for pairwise combinations of these labels. :param spatial_key: Key in .obsm containing coordinates in the physical space. Not used unless 'spatial_weights_matrix' is None, in which case this is required. Defaults to "spatial". :param n_spatial_neighbors: Optional, number of neighbors in the physical space for each cell. Not used unless 'spatial_weights_matrix' is None. :param spatial_weights_matrix: Spatial distance matrix, weighted by distance between spots. If not given, will compute at runtime. :param expr_weights_matrix: Gene expression distance matrix, weighted by distance in transcriptomic or PCA space. If not given, only the spatial distance matrix will be plotted. If given, will plot the spatial distance matrix in the left plot and the gene expression distance matrix in the right plot. :param reverse_expr_plot_orientation: If True, plot the gene expression connections in the form of a lower right triangle. If False, gene expression connections will be an upper left triangle just like the spatial connections. :param ax: Existing axes object, if applicable :param figsize: Width x height of desired figure window in inches :param zero_self_connections: If True, ignores intra-label interactions :param normalize_by_self_connections: Only used if 'zero_self_connections' is False. If True, normalize intra-label connections by the number of spots of that label :param shapes_style: If True plots squares, if False plots heatmap :param label_outline: If True, gives dark outline to axis tick label text :param max_scale: Only used for the case that 'shape_style' is True, gives maximum size of square :param colormap: Specifies colors to use for plotting. If dictionary, keys should be numerical labels corresponding to those of the Label object. :param title_str: Optionally used to give plot a title :param title_fontsize: Size of plot title- only used if 'title_str' is given. :param label_fontsize: Size of labels along the axes of the graph :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise you can provide a dictionary that properly modifies those keys according to your needs. :returns: Returns plot and axis object if 'save_show_or_return' is "all" :rtype: (fig, ax) .. py:function:: lisa(df: geopandas.GeoDataFrame) Create a plot with four panels. The first one is for the raw lisa (Local Indicators of Spatial Association ) score. The second one (the right one in the first row) is for the four quantiles. The third one is for the significance while the fourth one the five categories (not significant, hotspot, doughnut, coldspot and diamond. :param df: The GeoDataFrame returned from running `st.tl.lisa_geo_df(adata, gene)`. :returns: Nothing but plot the four panels . .. py:function:: lisa_quantiles(df: geopandas.GeoDataFrame) Scatterplot of the gene expression and its spatial lag. Categorization into the four regions (HH, HL, LH, LL) is also annotated. This function should be used in conjunction with `st.tl.lisa_geo_df`. :param df: The GeoDataFrame returned from running `st.tl.lisa_geo_df(adata, gene)`. :returns: Nothing but plot the scatterplot. .. py:function:: polarity(adata: anndata.AnnData, gene_dict: dict, region_key: str, mode: str = 'density') Simple function to visualize expression level varies along regions. :param adata: _description_ :type adata: AnnData :param gene_dict: _description_ :type gene_dict: dict :param region_key: _description_ :type region_key: str :param mode: _description_. Defaults to "density". :type mode: str, optional :returns: _description_ :rtype: _type_ .. py:function:: scatters(adata: anndata.AnnData, basis: Union[str, list] = 'umap', vf_key: Optional[str] = None, X_grid: Optional[numpy.ndarray] = None, V: Optional[numpy.ndarray] = None, x: int = 0, y: int = 1, z: int = 2, color: Union[str, list] = 'ntr', layer: Union[str, list] = 'X', highlights: Optional[list] = None, labels: Optional[list] = None, values: Optional[list] = None, theme: Optional[str] = None, cmap: Optional[str] = None, color_key: Union[dict, list] = None, color_key_cmap: Optional[str] = None, background: Optional[str] = None, ncols: int = 4, pointsize: Union[None, float] = None, figsize: tuple = (6, 4), show_legend='on data', use_smoothed: bool = True, aggregate: Optional[str] = None, show_arrowed_spines: bool = False, ax: Optional[matplotlib.axes.Axes] = None, sort: str = 'raw', save_show_or_return: typing_extensions.Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[Dict] = None, return_all: bool = False, add_gamma_fit: bool = False, frontier: bool = False, contour: bool = False, ccmap: Optional[str] = None, alpha: float = 0.1, calpha: float = 0.4, sym_c: bool = False, smooth: bool = False, dpi: int = 100, inset_dict: dict = {}, marker: str = None, group: str = None, add_group_gamma_fit: bool = False, affine_transform_degree: int = None, affine_transform_A: Optional[numpy.ndarray] = None, affine_transform_b: Optional[numpy.ndarray] = None, stack_colors: bool = False, stack_colors_threshold: float = 0.001, stack_colors_title: str = 'stacked colors', stack_colors_legend_size: int = 2, stack_colors_cmaps: Optional[str] = None, despline: bool = True, deaxis: bool = True, despline_sides: Union[None, List[str]] = None, projection: str = '2d', geo: bool = False, boundary_width: float = 0.2, boundary_color: str = 'black', aspect: str = 'auto', slices: Optional[int] = None, img_layers: Optional[int] = None, vf_plot_method: typing_extensions.Literal[cell, grid, stream] = 'cell', vf_kwargs: Optional[Dict[str, Union[str, int, float]]] = None, **kwargs) -> Union[None, matplotlib.axes.Axes] Plot an embedding as points. Currently, this only works for 2D embeddings. While there are many optional parameters to further control and tailor the plotting, you need only pass in the trained/fit umap model to get results. This plot utility will attempt to do the hard work of avoiding overplotting issues, and make it easy to automatically colour points by a categorical labelling or numeric values. This method is intended to be used within a Jupyter notebook with ``%matplotlib inline``. :param adata: :class:`~anndata.AnnData` an Anndata object :param basis: `str` The reduced dimension. :param vf_key: Optional, key in .obsm containing vector field information :param X_grid: Optional, array containing grid points for vector field plots :param V: Optional, array containing vector fields :param x: `int` (default: `0`) The column index of the low dimensional embedding for the x-axis. :param y: `int` (default: `1`) The column index of the low dimensional embedding for the y-axis. :param color: `string` (default: `ntr`) Any column names or gene expression, etc. that will be used for coloring cells. :param layer: `str` (default: `X`) The layer of data to use for the scatter plot. :param highlights: `list` (default: None) Which color group will be highlighted. if highlights is a list of lists - each list is relate to each color element. :param labels: array, shape (n_samples,) (optional, default None) An array of labels (assumed integer or categorical), one for each data sample. This will be used for coloring the points in the plot according to their label. Note that this option is mutually exclusive to the ``values`` option. :param values: array, shape (n_samples,) (optional, default None) An array of values (assumed float or continuous), one for each sample. This will be used for coloring the points in the plot according to a colorscale associated to the total range of values. Note that this option is mutually exclusive to the ``labels`` option. :param theme: string (optional, default None) A color theme to use for plotting. A small set of predefined themes are provided which have relatively good aesthetics. Available themes are: * 'blue' * 'red' * 'green' * 'inferno' * 'fire' * 'viridis' * 'darkblue' * 'darkred' * 'darkgreen' :param cmap: string (optional, default 'Blues') The name of a matplotlib colormap to use for coloring or shading points. If no labels or values are passed this will be used for shading points according to density (largely only of relevance for very large datasets). If values are passed this will be used for shading according the value. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param color_key: dict or array, shape (n_categories) (optional, default None) A way to assign colors to categoricals. This can either be an explicit dict mapping labels to colors (as strings of form '#RRGGBB'), or an array like object providing one color for each distinct category being provided in ``labels``. Either way this mapping will be used to color points according to the label. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param color_key_cmap: The name of a matplotlib colormap to use for categorical coloring. If an explicit ``color_key`` is not given a color mapping for categories can be generated from the label list and selecting a matching list of colors from the given colormap. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param background: string or None (optional, default 'None`) The color of the background. Usually this will be either 'white' or 'black', but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme. :param ncols: int (optional, default `4`) Number of columns for the figure. :param pointsize: `None` or `float` (default: None) The scale of the point size. Actual point cell size is calculated as `500.0 / np.sqrt(adata.shape[0]) * pointsize` :param figsize: `None` or `[float, float]` (default: None) The width and height of a figure. :param show_legend: bool (optional, default True) Whether to display a legend of the labels :param use_smoothed: bool (optional, default True) Whether to use smoothed values (i.e. M_s / M_u instead of spliced / unspliced, etc.). :param aggregate: `str` or `None` (default: `None`) The column in adata.obs that will be used to aggregate data points. :param show_arrowed_spines: bool (optional, default False) Whether to show a pair of arrowed spines representing the basis of the scatter is currently using. :param ax: `matplotlib.Axis` (optional, default `None`) The matplotlib axes object where new plots will be added to. Only applicable to drawing a single component. :param sort: `str` (optional, default `raw`) The method to reorder data so that high values points will be on top of background points. Can be one of {'raw', 'abs', 'neg'}, i.e. sorted by raw data, sort by absolute values or sort by negative values. :param save_show_or_return: Whether to save, show or return the figure. If "both", it will save and plot the figure at the same time. If "all", the figure will be saved, displayed and the associated axis and other object will be return. :param save_kwargs: A dictionary that will be passed to the save_fig function. By default, it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. :param return_all: `bool` (default: `False`) Whether to return all the scatter related variables. Default is False. :param add_gamma_fit: `bool` (default: `False`) Whether to add the line of the gamma fitting. This will automatically turn on if `basis` points to gene names and those genes have went through gamma fitting. :param frontier: `bool` (default: `False`) Whether to add the frontier. Scatter plots can be enhanced by using transparency (alpha) in order to show area of high density and multiple scatter plots can be used to delineate a frontier. See matplotlib tips & tricks cheatsheet (https://github.com/matplotlib/cheatsheets). Originally inspired by figures from scEU-seq paper: https://science.sciencemag.org/content/367/6482/1151. If `contour` is set to be True, `frontier` will be ignored as `contour` also add an outlier for data points. :param contour: `bool` (default: `False`) Whether to add an countor on top of scatter plots. We use tricontourf to plot contour for non-gridded data. The shapely package was used to create a polygon of the concave hull of the scatters. With the polygon we then check if the mean of the triangulated points are within the polygon and use this as our condition to form the mask to create the contour. We also add the polygon shape as a frontier of the data point (similar to when setting `frontier = True`). When the color of the data points is continuous, we will use the same cmap as for the scatter points by default, when color is categorical, no contour will be drawn but just the polygon. cmap can be set with `ccmap` argument. See below. This has recently changed to use seaborn's kdeplot. :param ccmap: `str` or `None` (default: `None`) The name of a matplotlib colormap to use for coloring or shading points the contour. See above. :param calpha: `float` (default: `0.4`) Contour alpha value passed into sns.kdeplot. The value should be inbetween [0, 1] :param sym_c: `bool` (default: `False`) Whether do you want to make the limits of continuous color to be symmetric, normally this should be used for plotting velocity, jacobian, curl, divergence or other types of data with both positive or negative values. :param smooth: `bool` or `int` (default: `False`) Whether do you want to further smooth data and how much smoothing do you want. If it is `False`, no smoothing will be applied. If `True`, smoothing based on one step diffusion of connectivity matrix (`.uns['moment_cnn'] will be applied. If a number larger than 1, smoothing will based on `smooth` steps of diffusion. :param dpi: `float`, (default: 100.0) The resolution of the figure in dots-per-inch. Dots per inches (dpi) determines how many pixels the figure comprises. dpi is different from ppi or points per inches. Note that most elements like lines, markers, texts have a size given in points so you can convert the points to inches. Matplotlib figures use Points per inch (ppi) of 72. A line with thickness 1 point will be 1./72. inch wide. A text with fontsize 12 points will be 12./72. inch heigh. Of course if you change the figure size in inches, points will not change, so a larger figure in inches still has the same size of the elements.Changing the figure size is thus like taking a piece of paper of a different size. Doing so, would of course not change the width of the line drawn with the same pen. On the other hand, changing the dpi scales those elements. At 72 dpi, a line of 1 point size is one pixel strong. At 144 dpi, this line is 2 pixels strong. A larger dpi will therefore act like a magnifying glass. All elements are scaled by the magnifying power of the lens. see more details at answer 2 by @ImportanceOfBeingErnest: https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size :param inset_dict: `dict` (default: {}) A dictionary of parameters in inset_ax. Example, something like {"width": "5%", "height": "50%", "loc": 'lower left', "bbox_to_anchor": (0.85, 0.90, 0.145, 0.145), "bbox_transform": ax.transAxes, "borderpad": 0} See more details at https://matplotlib.org/api/_as_gen/mpl_toolkits.axes_grid1.inset_locator.inset_axes.html or https://stackoverflow.com/questions/39803385/what-does-a-4-element-tuple-argument-for-bbox-to-anchor-mean -in-matplotlib :param marker: `str` (default: None) The marker style. marker can be either an instance of the class or the text shorthand for a particular marker. See matplotlib.markers for more information about marker styles. :param group: The key to the column in adata.obs that points to cell groups that will be used to include the gamma fittings. :param add_group_gamma_fit: Whether or not to add the gamma fitting line for each cell group. :param affine_transform_degree: Transform coordinates of points according to some degree. :param affine_transform_A: Coefficients in affine transformation Ax + b. 2D for now. :param affine_transform_b: Bias in affine transformation Ax + b. :param stack_colors: Whether to stack all color on the same ax passed above. Currently only support 18 sequential matplotlib default cmaps assigning to different color groups. (#colors should be smaller than 18, reuse if #colors > 18. To-do: generate cmaps according to #colors) :param stack_colors_threshold: A threshold for filtering points values < threshold when drawing each color. E.g. if you do not want points with values < 1 showing up on axis, set threshold to be 1 :param stack_colors_title: The title for the stack_color plot. :param stack_colors_legend_size: Control the legend size in stack color plot. :param stack_colors_cmaps: The colormap used to stack different genes in a single plot. :param despline: Whether to remove splines of the figure. :param despline_sides: Which side of splines should be removed. Can be any combination of `["bottom", "right", "top", "left"]`. :param deaxis: Whether to remove axis ticks of the figure. :param projection: The projection of the figure. Can be "2d", "3d", "polar", etc. :param geo: `bool` (default: `False`) Use geometry info or not. :param boundary_width: `float`, (default: 0.2) The line width of boundary. :param boundary_color: (default: "black") The color value of boundary. :param aspect: Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit. In physical spatial plot, the default is 'equal'. See more details at: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_aspect.html :param slices: The index to the tissue slice, will used in adata.uns["spatial"][slices]. :param img_layers: The index to the (staining) image of a tissue slice, will be used in adata.uns["spatial"][slices]["images"]. :param vf_plot_method: The method used to plot the vector field. Can be one of the following: 'cell': Plot the vector field at the center of each cell. 'grid': Plot the vector field on a grid. 'stream': Plot the vector field as stream lines. :param vf_kwargs: Optional dictionary containing parameters for vector field plotting :param kwargs: Additional arguments passed to plt functions (plt.scatters, plt.quiver, plt.streamplot). :returns: Either None or a matplotlib axis with the relevant plot displayed. If you are using a notbooks and have ``%matplotlib inline`` set then this will simply display inline. :rtype: result .. py:function:: space(adata: anndata.AnnData, color: Optional[Union[List[str], str, None]] = None, genes: List[str] = [], gene_cmaps=None, space: str = 'spatial', width: float = 6, marker: str = '.', pointsize: Optional[float] = None, dpi: int = 100, ps_sample_num: int = 1000, alpha: float = 0.8, stack_genes: bool = False, stack_genes_threshold: float = 0.01, stack_colors_legend_size: int = 10, figsize=None, *args, **kwargs) Scatter plot for physical coordinates of each cell. :param adata: An AnnData object that contains the physical coordinates for each bin/cell, etc. :param genes: The gene list that will be used to plot the gene expression on the same scatter plot. Each gene will have a different color. :param color: `string` (default: `ntr`) Any or any list of column names or gene name, etc. that will be used for coloring cells. If `color` is not None, stack_genes will be disabled automatically because `color` can contain non numerical values. :param space: The key to space coordinates. :param stack_genes: Whether to show all gene plots on the same plot :param stack_genes_threshold: Lower bound of gene values that will be drawn on the plot :param stack_colors_legend_size: Control the size of legend when stacking genes :param alpha: The alpha value of the scatter points :param width: Width of the figure :param marker: A string representing some marker from matplotlib https://matplotlib.org/stable/api/markers_api.html#module-matplotlib.markers :param pointsize: The size of the points on the scatter plot :param dpi: `float`, (default: 100.0) The resolution of the figure in dots-per-inch. Dots per inches (dpi) determines how many pixels the figure comprises. dpi is different from ppi or points per inches. Note that most elements like lines, markers, texts have a size given in points so you can convert the points to inches. Matplotlib figures use Points per inch (ppi) of 72. A line with thickness 1 point will be 1./72. inch wide. A text with fontsize 12 points will be 12./72. inch heigh. Of course if you change the figure size in inches, points will not change, so a larger figure in inches still has the same size of the elements.Changing the figure size is thus like taking a piece of paper of a different size. Doing so, would of course not change the width of the line drawn with the same pen. On the other hand, changing the dpi scales those elements. At 72 dpi, a line of 1 point size is one pixel strong. At 144 dpi, this line is 2 pixels strong. A larger dpi will therefore act like a magnifying glass. All elements are scaled by the magnifying power of the lens. see more details at answer 2 by @ImportanceOfBeingErnest: https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size :param ps_sample_num: The number of bins / cells that will be sampled to estimate the distance between different bin / cells :param %: :type %: scatters.parameters.no_adata|basis|figsize :returns: plots gene or cell feature of the adata object on the physical spatial coordinates. .. py:function:: 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['none', 'static', 'trame']] = 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) Visualize the torsion result. :param adata: An anndata object contain acceleration values in ``.obs[acceleration_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param acceleration_key: The key in ``.obs`` that corresponds to the acceleration values in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :param \*\*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'``. :rtype: cpo .. rubric:: 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] ) .. py:function:: backbone(backbone_model: pyvista.PolyData, backbone_key: str = 'backbone', backbone_model_size: Union[float, int] = 8, backbone_colormap: Optional[str] = None, backbone_ambient: Union[float, list] = 0.2, backbone_opacity: Union[float, numpy.ndarray, list] = 1.0, nodes_key: Optional[str] = 'nodes', nodes_label_size: Union[float, int] = 18, bg_model: Optional[Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.MultiBlock]] = None, bg_key: Optional[Union[str, list]] = None, bg_model_style: Union[Literal['points', 'surface', 'wireframe'], list] = 'points', bg_model_size: Union[float, list] = 10, bg_colormap: Optional[Union[str, list]] = None, bg_ambient: Union[float, list] = 0.2, bg_opacity: Union[float, numpy.ndarray, list] = 0.6, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, filename: Optional[str] = None, jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, window_size: tuple = (2048, 2048), background: str = 'white', cpo: Union[str, list] = 'iso', **kwargs) Visualize constructed 3D backbone model. :param backbone_model: The constructed backbone model. :param backbone_key: Any point_data names or cell_data names to be used for coloring ``backbone_model``. :param backbone_model_size: The thickness of backbone. :param 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. :param 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. :param 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'). :param nodes_key: The key that corresponds to the coordinates of the nodes in the backbone. :param nodes_label_size: Sets the size of the title font. :param bg_model: The background model used to construct backbone model. :param bg_key: Any point_data names or cell_data names to be used for coloring ``bg_model``. :param bg_model_style: Visualization style of ``bg_model``. One of the following: * ``bg_model_style = 'surface'``, * ``bg_model_style = 'wireframe'``, * ``bg_model_style = 'points'``. :param 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. :param 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. :param 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. :param 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'). :param show_axes: Whether to add a camera orientation widget to the active renderer. :param show_legend: whether to add a legend of ``bg_model`` 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 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 window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :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 \*\*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'``. :rtype: cpo .. py:function:: 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['none', 'static', 'trame']] = 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) Visualize the curl result. :param adata: An anndata object contain curl values in ``.obs[curl_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param curl_key: The key in ``.obs`` that corresponds to the curl values in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :param \*\*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'``. :rtype: cpo .. rubric:: 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] ) .. py:function:: 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['none', 'static', 'trame']] = 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) Visualize the curvature result. :param adata: An anndata object contain curvature values in ``.obs[curvature_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param curvature_key: The key in ``.obs`` that corresponds to the curvature values in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :param \*\*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'``. :rtype: cpo .. rubric:: 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] ) .. 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) .. py:function:: 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['none', 'static', 'trame']] = 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) Visualize the divergence result. :param adata: An anndata object contain curl values in ``.obs[divergence_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param divergence_key: The key in ``.obs`` that corresponds to the divergence values in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :param 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. :param 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :param \*\*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'``. :rtype: cpo .. rubric:: 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] ) .. py:function:: 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['none', 'static', 'trame']] = 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_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, **kwargs) Visualize the jacobian result. :param adata: An anndata object contain jacobian matrix in ``.uns[jacobian_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param jacobian_key: The key in ``.uns`` that corresponds to the jacobian matrix in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :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 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.`` :param window_size: Window size in pixels. The default window_size is ``[512*3, 512*3]``. :param background: The background color of the window. :param 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :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 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'``. :rtype: cpo .. rubric:: 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] ) .. py:function:: merge_animations(mp4_files: Optional[list] = None, mp4_folder: Optional[list] = None, filename: str = 'merged_animation.mp4') Use MoviePy to compose a new animation and play multiple animations together in the new animation. :param mp4_files: A list containing absolute paths to mp4 files that need to be played together. :param 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. :param filename: Absolute path to save the newly composed animation. .. rubric:: Examples st.pl.merge_animations(mp4_files=["animation1.mp4", "animation2.mp4"], filename=f"merged_animation.mp4") .. 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:: pairwise_iteration(adataA: anndata.AnnData, adataB: anndata.AnnData, layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', iter_key: str = 'iter_spatial', id_key: str = 'slices', filename: str = 'animate.mp4', jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Optional[Union[str, list]] = None, window_size: Optional[tuple] = None, background: str = 'black', modelA_cmap: str = 'dodgerblue', modelB_cmap: str = 'red', ambient: Union[int, float] = 0.3, modelA_opacity: Union[int, float] = 0.8, modelB_opacity: Union[int, float] = 1.0, model_size: Union[float, list] = 6.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, framerate: int = 6, **kwargs) Visualize the results of each iteration in the alignment process. :param adataA: Anndata object of modelA. :param adataB: Anndata object of modelB. :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 iter_key: The key in ``.uns`` that corresponds to the result of each iteration of the iterative process. :param id_key: The key in ``.obs`` that corresponds to the model id of each bucket. :param 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``. :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 window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :param modelA_cmap: Colors to use for plotting modelA. The default colormap is ``'dodgerblue'``. :param modelB_cmap: Colors to use for plotting modelB. The default colormap is ``'red'``. :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 modelA_opacity: Opacity of the modelA. :param modelB_opacity: Opacity of the modelB. :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 framerate: Frames per second. :param \*\*kwargs: Additional parameters that will be passed to ``three_d_animate`` function. .. py:function:: pairwise_iteration_panel(adataA: anndata.AnnData, adataB: anndata.AnnData, layer: str = 'X', group_key: Union[str, list] = None, select_group: Union[str, list] = None, spatial_key: str = 'align_spatial', iter_key: str = 'iter_spatial', filename: str = 'animate.mp4', jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, id_key: Optional[str] = None, cpo: Optional[Union[str, list]] = None, window_size: Optional[tuple] = None, background: str = 'black', modelA_cmap: str = 'dodgerblue', modelB_cmap: str = 'red', ambient: Union[int, float] = 0.3, modelA_opacity: Union[int, float] = 0.8, modelB_opacity: Union[int, float] = 1.0, model_size: Union[float, list] = 6.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, framerate: int = 6, **kwargs) .. py:function:: pairwise_mapping(idA: str = 'sampleA', idB: str = 'sampleB', adataA: Optional[anndata.AnnData] = None, adataB: Optional[anndata.AnnData] = None, pi: Optional[numpy.ndarray] = None, modelA: Optional[pyvista.PolyData] = None, modelB: Optional[pyvista.PolyData] = None, model_lines: Optional[pyvista.PolyData] = None, layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', keep_all: bool = False, distance: Optional[Union[int, float]] = 300, direction: Optional[Literal['x', 'y', 'z']] = 'z', filename: Optional[str] = None, jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Optional[Union[str, list]] = 'iso', window_size: Optional[tuple] = (1024, 1024), background: str = 'black', modelA_cmap: str = 'dodgerblue', modelA_amap: Union[float, list] = 1.0, modelB_cmap: str = 'red', modelB_amap: Union[float, list] = 1.0, line_color: str = 'gainsboro', line_alpha: Union[float, list] = 1.0, ambient: float = 0.3, model_opacity: float = 1, line_opacity: float = 0.03, model_size: Union[float, list] = 6.0, line_size: Union[float, list] = 2.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 the pairing of cells between two models. :param idA: ID of modelA. :param idB: ID of modelB. :param adataA: Anndata object of modelA. :param adataB: Anndata object of modelB. :param pi: The pi matrix obtained by alignment. :param modelA: The point cloud model of adataA. :param modelB: The point cloud model of adataB. :param model_lines: Cell connection lines between modelA and modelB :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 keep_all: Whether to retain all the optimal relationships obtained only based on the pi matrix, If ``keep_all`` is False, the optimal relationships obtained based on the pi matrix and the nearest coordinates. :param distance: Distance between modelA and modelB when visualizing. :param direction: The direction between modelA and modelB when visualizing. :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 window_size: Window size in pixels. The default window_size is ``(1024, 1024)``. :param background: The background color of the window. :param modelA_cmap: Colors to use for plotting modelA. The default colormap is ``'dodgerblue'``. :param modelA_amap: The opacity of the colors to use for plotting modelA. The default alphamap is ``1.0``. :param modelB_cmap: Colors to use for plotting modelB. The default colormap is ``'red'``. :param modelB_amap: The opacity of the colors to use for plotting modelB. The default alphamap is ``1.0``. :param line_color: Colors to use for plotting lines. The default colormap is ``'gainsboro'``. :param line_alpha: Alpha to use for plotting lines. The default colormap is ``'gainsboro'``. :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 model_opacity: Opacity of the modelA and modelB. :param line_opacity: Opacity of the lines. :param model_size: The point size of any nodes in the dataset plotted. :param line_size: The line size of lines 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_plot`` function. :returns: The point cloud models of adataA. pcB: The point cloud models of adataB. model_lines: Cell mapping lines between modelA and modelB. :rtype: pcA .. py:function:: pi_heatmap(pi: numpy.ndarray, model1_name: str = 'model1', model2_name: str = 'model2', colormap: str = 'hot_r', fig_height: Union[int, float] = 3, robust: bool = False, vmin: Optional[Union[int, float]] = None, vmax: Optional[Union[int, float]] = None, fontsize: Union[int, float] = 12, filename: Optional[str] = None, **kwargs) Visualize a heatmap of the pi matrix. :param pi: The pi matrix obtained by alignment. :param model1_name: The name/id of model1. :param model2_name: The name/id of model2. :param colormap: Colors to use for plotting heatmap. The default colormap is ``'hot_r'``. :param fig_height: Figure height. :param robust: If True and vmin or vmax are absent, the colormap range is computed with robust quantiles instead of the extreme values. :param vmin: Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments. :param vmax: Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments. :param fontsize: The font size of x label and y label. :param filename: Filename of output file. :param \*\*kwargs: Additional parameters that will be passed to ``sns.heatmap`` function. .. py:function:: 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', 'html']] = 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) Animated visualization of 3D reconstruction model. :param models: A List of reconstructed models or a MultiBlock. :param stable_model: The model that do not change with time in animation. :param 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'`` :param key: The key under which are the labels. :param 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``. :param 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. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :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 show_outline: whether to produce an outline of the full extent for the model. :param 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. :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 framerate: Frames per second. Only available when filename ending with ``.mp4`` or ``.gif``. :param 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. .. py:function:: 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', 'html']] = 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) Multi-view visualization of reconstructed 3D model. If you want to draw a legend in each sub-window, please ensure that the key names used in each legend are different. :param model: A MultiBlock of reconstructed models or a reconstructed model. :param key: The key under which are the labels. :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'``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :param 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. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :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 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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :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 show_outline: whether to produce an outline of the full extent for the model. :param 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. :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 view_up: The normal to the orbital plane. Only available when filename ending with ``.mp4`` or ``.gif``. :param framerate: Frames per second. Only available when filename ending with ``.mp4`` or ``.gif``. :param 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. .. py:function:: 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', 'html']] = 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, show_axes: bool = False) Visualize reconstructed 3D model. :param model: A reconstructed model. :param key: The key under which are the labels. :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'``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :param 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. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :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 show_outline: whether to produce an outline of the full extent for the model. :param 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. :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 view_up: The normal to the orbital plane. Only available when filename ending with ``.mp4`` or ``.gif``. :param framerate: Frames per second. Only available when filename ending with ``.mp4`` or ``.gif``. :param 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'``. :rtype: cpo .. py:function:: 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['none', 'static', 'trame']] = 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) Visualize the torsion result. :param adata: An anndata object contain torsion values in ``.obs[torsion_key]``. :param model: A reconstructed model contains ``obs_index`` values. :param torsion_key: The key in ``.obs`` that corresponds to the torsion values in the anndata object. :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``. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :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 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. :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_style: Visualization style of the model. One of the following: * ``model_style = 'surface'``, * ``model_style = 'wireframe'``, * ``model_style = 'points'``. :param model_size: If ``model_style = 'points'``, point size of any nodes in the dataset plotted. If ``model_style = 'wireframe'``, thickness of lines. :param \*\*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'``. :rtype: cpo .. rubric:: 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] )