spateo.plotting.static.agg¶
Plotting functions for aggregated UMI counts.
Functions¶
|
Display raw data within an AnnData. |
|
Indicate selected QC regions with boxes on the full tissue. |
|
Display QC regions. |
Module Contents¶
- spateo.plotting.static.agg.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) Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] | None [source]¶
Display raw data within an AnnData.
- Parameters:
- adata
Anndata containing aggregated UMI counts.
- layer
Layer to display. Defaults to X.
- ax
Axes to plot.
- show_cbar
Whether or not to show a colorbar next to the plot.
- use_scale
Whether or not to plot in physical units. Only valid when appropriate scale keys are present in .uns
- absolute
Whether to set the axes to be in absolute coordinates. By default, relative coordinates are used (i.e. the axes start at zero).
- labels
Whether the input data contains labels, encoded as positive integers.
- downscale
Downscale image by this amount for faster plotting.
- 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.
- 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.
- 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.
- 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.
- **kwargs
Additional keyword arguments are all passed to
imshow()
.
- Returns:
The figure and axis if ax is not provided.
- spateo.plotting.static.agg.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)[source]¶
Indicate selected QC regions with boxes on the full tissue.
- Parameters:
- adata
Input Anndata
- layer
Layer to display
- use_scale
Whether or not to plot in physical units. Only valid when appropriate scale keys are present in .uns
- box_kwargs
Keyword arguments to pass to
patches.Rectangle()
. By default, the boxes will be transparent with red outlines of 1 point thickness.- ax
Axes to plot.
- 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.
- 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.
- 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.
- **kwargs
Additional keyword arguments are all passed to
imshow()
.
- spateo.plotting.static.agg.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) Tuple[matplotlib.figure.Figure, numpy.ndarray] | None [source]¶
Display QC regions.
- Parameters:
- adata
Input Anndata
- layer
Layer to display
- axes
Numpy array (possibly 2D) of Matplotlib axes to plot each region. This option is useful when trying to overlay multiple layers together.
- ncols
Number of columns when displaying multiple panels.
- 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.
- 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.
- 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.
- **kwargs
Additional keyword arguments are all passed to
imshow()
.
- Returns:
The figure and axes if axes is not provided.