scirpy.pl.clonotype_network#
- scirpy.pl.clonotype_network(adata, *, color=None, basis='clonotype_network', panel_size=(10, 10), color_by_n_cells=False, scale_by_n_cells=True, base_size=None, size_power=None, use_raw=None, show_labels=True, label_fontsize=None, label_fontweight='bold', label_fontoutline=3, label_alpha=0.6, label_y_offset=2, legend_fontsize=None, legend_width=2, show_legend=None, show_size_legend=True, palette=None, cmap=None, edges_color=None, edges_cmap=<matplotlib.colors.LinearSegmentedColormap object>, edges=True, edges_width=0.4, frameon=None, title=None, ax=None, fig_kws=None, airr_mod='airr')#
Plot the Clonotype network.
`
Plot the Clonotype network.
Requires running
scirpy.tl.clonotype_network()first, to compute the layout.The clonotype network usually consists of many disconnected components, each of them representing a clonotype. Each node represents cells with an identical receptor configuration (i.e. identical CDR3 sequences, and identical v genes if
same_v_genewas specified during clonotype definition). The size of each dot refers to the number of cells with the same receptor configurations.For more details on the clonotype definition, see
scirpy.tl.define_clonotype_clusters()and the respective section in the tutorial.When the network is colored by continuous variables (genes, or numeric columns from
obs), the average of the cells in each dot is computed. When the network is colored by categorical variables (categorical columns fromobs), different categories per dot are visualized as pie chart.The layouting algorithm of
scirpy.tl.clonotype_network()takes point sizes into account. For this reason, we recommend providingbase_sizeandsize_poweralready to the tool function.- Parameters:
adata (
Union[AnnData,MuData,DataHandler]) – AnnData or MuData object that contains AIRR information.color (
Union[Sequence[str],str,None] (default:None)) – Keys for annotations of observations/cells or variables/genes, e.g.patientorCD8A.basis (
str(default:'clonotype_network')) – Key under which the graph layout coordinates are stored inadata.obsm.panel_size (
tuple[float,float] (default:(10, 10))) – Size of the main figure panel in inches.color_by_n_cells (
bool(default:False)) – Color the nodes by the number of cells they represent. This overrides thecoloroption.scale_by_n_cells (
bool(default:True)) – Scale the nodes by the number of cells they represent. If this is set toTrue, we recommend using a “size-aware” layout inscirpy.tl.clonotype_network()to avoid overlapping nodes (default).base_size (
Optional[float] (default:None)) – Size of a point representing 1 cell. Per default, the value provided toscirpy.tl.clonotype_network()is used. This option allows to override this value without recomputing the layout.size_power (
Optional[float] (default:None)) – Point sizes are raised to the power of this value. Per default, the value provided toscirpy.tl.clonotype_network()is used. This option allows to override this value without recomputing the layout.use_raw (
Optional[bool] (default:None)) – Useadata.rawfor plotting gene expression values. Default: Useadata.rawif it exists, andadataotherwise.show_labels (
bool(default:True)) – IfTrueplot clonotype ids on top of the subnetworks.label_fontsize (
Optional[int] (default:None)) – Fontsize for the clonotype labelslabel_fontweight (
str(default:'bold')) – Fontweight for the clonotype labelslabel_fontoutline (
int(default:3)) – Size of the fontoutline added to the clonotype labels. Set toNoneto disable.label_alpha (
float(default:0.6)) – Transparency of the clonotype labelslabel_y_offset (
float(default:2)) – Offset the clonotype label on the y axis for better visibility of the subnetworks.legend_fontsize (default:
None) – Font-size for the legend.show_legend (
Optional[bool] (default:None)) – Whether to show a legend (when plotting categorical variables) or a colorbar (when plotting continuous variables) on the right margin. Per default, a legend is shown if the number of categories is smaller than 50, other wise no legend is shown.show_legend_size – Whether to show a legend for dot sizes on the right margin. This option is only applicable if
scale_by_n_cellsisTrue.palette (
Union[str,Sequence[str],Cycler,None] (default:None)) – Colors to use for plotting categorical annotation groups. The palette can be a validListedColormapname ('Set2','tab20', …) or aCyclerobject. a different color map for each panel.cmap (
Union[str,Colormap,None] (default:None)) – Colormap to use for plotting continuous variables.edges_color (
Optional[str] (default:None)) – Color of the edges. Set toNoneto color by connectivity and use the color map provided byedges_cmap.edges_cmap (
Union[Colormap,str] (default:<matplotlib.colors.LinearSegmentedColormap object at 0x7f7c6598f940>)) – Colormap to use for coloring edges by connectivity.edges (
bool(default:True)) – Whether to show the edges or not.edges_width (
float(default:0.4)) – width of the edgesframeon (
Optional[bool] (default:None)) – Whether to show a frame around the plottitle (
Union[Sequence[str],str,None] (default:None)) – The main plot titleax (
Optional[Axes] (default:None)) – Add the plot to a predefined Axes object.cax – Add the colorbar (if any) to this predefined Axes object.
fig_kws (
Optional[dict] (default:None)) – Parameters passed to thematplotlib.pyplot.figure()call if noaxis specified.airr_mod (
str(default:'airr')) – Name of the modality with AIRR information is stored in theMuDataobject. if anAnnDataobject is passed to the function, this parameter is ignored.
- Return type:
- Returns:
A list of axes objects, containing one element for each
color, or None ifshow == True.