stlearn.pl.cluster_plot

stlearn.pl.cluster_plot(adata: AnnData, title: Optional[str] = None, figsize: Optional[Tuple[float, float]] = None, cmap: Optional[str] = 'default', use_label: Optional[str] = None, list_clusters: Optional[list] = None, ax: Optional[Axes] = None, fig: Optional[Figure] = None, show_plot: Optional[bool] = True, show_axis: Optional[bool] = False, show_image: Optional[bool] = True, show_color_bar: Optional[bool] = True, zoom_coord: Optional[float] = None, crop: Optional[bool] = True, margin: Optional[bool] = 100, size: Optional[float] = 5, image_alpha: Optional[float] = 1.0, cell_alpha: Optional[float] = 1.0, fname: Optional[str] = None, dpi: Optional[int] = 120, show_subcluster: Optional[bool] = False, show_cluster_labels: Optional[bool] = False, show_trajectories: Optional[bool] = False, reverse: Optional[bool] = False, show_node: Optional[bool] = False, threshold_spots: Optional[int] = 5, text_box_size: Optional[float] = 5, color_bar_size: Optional[float] = 10, bbox_to_anchor: Optional[Tuple[float, float]] = (1, 1), trajectory_node_size: Optional[int] = 10, trajectory_alpha: Optional[float] = 1.0, trajectory_width: Optional[float] = 2.5, trajectory_edge_color: Optional[str] = '#f4efd3', trajectory_arrowsize: Optional[int] = 17) Optional[AnnData][source]

Allows the visualization of a cluster results as the discretes values of dot points in the Spatial transcriptomics array. We also support to visualize the spatial trajectory results

Parameters:
  • adata – Annotated data matrix.

  • title – Title name of the figure.

  • figsize – Figure size with the format (width,height).

  • cmap – Color map to use for continous variables or discretes variables (e.g. viridis, Set1,…).

  • use_label – Key for the label use in adata.obs (e.g. leiden, louvain,…).

  • list_clusters – A set of cluster to be displayed in the figure (e.g. [0,1,2,3]).

  • ax – A matplotlib axes object.

  • show_plot – Option to display the figure.

  • show_image – Option to display the H&E image.

  • show_color_bar – Option to display color bar.

  • crop – Option to crop the figure based on the spot locations.

  • margin – Margin to crop.

  • size – Spot size to display in figure.

  • image_alpha – Opacity of H&E image.

  • cell_alpha – Opacity of spots/cells.

  • use_raw – Option to use adata.raw data.

  • fname – Output path to the output if user want to save the figure.

  • dpi – Dots per inch values for the output.

  • show_subcluster – Display the subcluster in the figure.

  • show_cluster_labels – Display the labels of clusters.

  • show_trajectories – Display the spatial trajectory analysis results.

  • reverse – Reverse the direction of spatial trajectories.

  • show_node – Show node of PAGA graph mapping in spatial.

  • threshold_spots – The number of spots threshold for not display the subcluster labels

  • text_box_size – The font size in the box of labels.

  • color_bar_size – The size of color bar.

  • bbox_to_anchor – Set the position of box of color bar. Default is (1,1)

Examples

>>> import stlearn as st
>>> adata = st.datasets.example_bcba()
>>> label = "louvain"
>>> st.pl.cluster_plot(adata, use_label = label, show_trajectories = True)