dot_heatmap

besca.pl.dot_heatmap(adata, genes, group_by='louvain', plot_absolute=True, raw=True, color_map='Reds', figsize=None, order=None, switch_axis=False)[source]

Generate a dot plot, filled with heatmap of individuals cells gene expression.

This function generates a plot where the genes are plotted on the X-axis and the groups on the y-axis. For each coordinate a circle plot is generated where the size of the circle represents the number of cells in the group and the fill of the circle shows the gene expression of each individual cell as a sorted heatmap.

If switch_axis = True then the genes are plotted on the y-axis and the groups on the x-axis.

Note this function takes some time to calculate depending on the number of individual points that need to be plotted.

Parameters:
  • adata (AnnData) – anndata object containing data that is to be visualized

  • genes ([‘str’]) – list of strings identifying the genes that are to be plotted

  • group_by (str | default = ‘louvain’) – string identifying the column in adata.obs that is to be used to generate the groups

  • plot_absolute (bool | default) – boolian value used to indicate if the absolute geneexpression or the relativ gene expression should be plotted (currently not fully implemented)

  • raw (bool | default = True) – boolian value indicating if the data saved in adata.raw should be used to generate the plot

  • color_map (str) – string identifying the type of color_map that should be used to plot the results (needs to exist!)

  • figsize ((value, value) or None | default = None) – optional parameter to define the figure size of the plot that is to be generated

  • order ([‘str’] or None | default = None) – optional parameter to pass an ordered list of groups to the function to specify the order in which they are to be plotted

  • switch_axis (bool | default = False) – boolian value to determine if the axes should be switched. Per default the genes are plotted on the x-axis.

Returns:

A matplotlib figure element containing the generated plot. To save the figure this plot will need to be passed to a parameter and saved in a second step through the fig.savefig() function call.

Return type:

Figure

Examples

>>> # import libraries and dataset
>>> import besca as bc
>>> adata = bc.datasets.simulated_Kotliarov2020_processed()
>>> genes = ['Gene_3', 'Gene_6']
>>> fig = bc.pl.dot_heatmap(adata, genes=genes, group_by='leiden')