, *, 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 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_gene was 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 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 from obs), different categories per dot are visualized as pie chart.

The layouting algorithm of takes point sizes into account. For this reason, we recommend providing base_size and size_power already to the tool function.

  • 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. patient or CD8A.

  • basis (str (default: 'clonotype_network')) – Key under which the graph layout coordinates are stored in adata.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 the color option.

  • scale_by_n_cells (bool (default: True)) – Scale the nodes by the number of cells they represent. If this is set to True, we recommend using a “size-aware” layout in to avoid overlapping nodes (default).

  • base_size (Optional[float] (default: None)) – Size of a point representing 1 cell. Per default, the value provided to 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 to is used. This option allows to override this value without recomputing the layout.

  • use_raw (Optional[bool] (default: None)) – Use adata.raw for plotting gene expression values. Default: Use adata.raw if it exists, and adata otherwise.

  • show_labels (bool (default: True)) – If True plot clonotype ids on top of the subnetworks.

  • label_fontsize (Optional[int] (default: None)) – Fontsize for the clonotype labels

  • label_fontweight (str (default: 'bold')) – Fontweight for the clonotype labels

  • label_fontoutline (int (default: 3)) – Size of the fontoutline added to the clonotype labels. Set to None to disable.

  • label_alpha (float (default: 0.6)) – Transparency of the clonotype labels

  • label_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_cells is True.

  • palette (Union[str, Sequence[str], Cycler, None] (default: None)) – Colors to use for plotting categorical annotation groups. The palette can be a valid ListedColormap name ('Set2', 'tab20', …) or a Cycler object. 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 to None to color by connectivity and use the color map provided by edges_cmap.

  • edges_cmap (Union[Colormap, str] (default: <matplotlib.colors.LinearSegmentedColormap object at 0x7f92e7cc5690>)) – 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 edges

  • frameon (Optional[bool] (default: None)) – Whether to show a frame around the plot

  • title (Union[Sequence[str], str, None] (default: None)) – The main plot title

  • ax (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 the matplotlib.pyplot.figure() call if no ax is specified.

  • airr_mod (str (default: 'airr')) – Name of the modality with AIRR information is stored in the MuData object. if an AnnData object is passed to the function, this parameter is ignored.

Return type:



A list of axes objects, containing one element for each color, or None if show == True.