dynamo.pl.bubble

dynamo.pl.bubble(adata, genes, group, gene_order=None, group_order=None, layer=None, theme=None, cmap=None, color_key=None, color_key_cmap='Spectral', background='white', pointsize=None, vmin=0, vmax=100, sym_c=False, alpha=0.8, edgecolor=None, linewidth=0, type='violin', sort='diagnoal', transpose=False, rotate_xlabel='horizontal', rotate_ylabel='horizontal', figsize=None, save_show_or_return='show', save_kwargs={}, **kwargs)[source]

Bubble plots generalized to velocity, acceleration, curvature. It supports either the dot or violin plot mode. This function is loosely based on https://github.com/QuKunLab/COVID-19/blob/master/step3_plot_umap_and_marker_gene_expression.ipynb

# add sorting :param adata: an Annodata object :type adata: AnnData :param genes: The gene list, i.e. marker gene or top acceleration, curvature genes, etc. :type genes: list :param group: The column key in adata.obs that will be used to group cells. :type group: str :param gene_order: The gene groups order that will show up in the resulting bubble plot. :type gene_order: None or list (default: None) :param group_order: The cells groups order that will show up in the resulting bubble plot. :type group_order: None or list (default: None) :param layer: The layer of data to use for the bubble plot. :type layer: None or str (default: None) :param theme: A color theme to use for plotting. A small set of

predefined themes are provided which have relatively good aesthetics. Available themes are:

  • ‘blue’

  • ‘red’

  • ‘green’

  • ‘inferno’

  • ‘fire’

  • ‘viridis’

  • ‘darkblue’

  • ‘darkred’

  • ‘darkgreen’

Parameters
  • cmap (string (optional, default 'Blues')) – The name of a matplotlib colormap to use for coloring or shading points. If no labels or values are passed this will be used for shading points according to density (largely only of relevance for very large datasets). If values are passed this will be used for shading according the value. Note that if theme is passed then this value will be overridden by the corresponding option of the theme.

  • color_key (dict or array, shape (n_categories) (optional, default None)) – A way to assign colors to categoricals. This can either be an explicit dict mapping labels to colors (as strings of form ‘#RRGGBB’), or an array like object providing one color for each distinct category being provided in labels. Either way this mapping will be used to color points according to the label. Note that if theme is passed then this value will be overridden by the corresponding option of the theme.

  • color_key_cmap (string (optional, default 'Spectral')) – The name of a matplotlib colormap to use for categorical coloring. If an explicit color_key is not given a color mapping for categories can be generated from the label list and selecting a matching list of colors from the given colormap. Note that if theme is passed then this value will be overridden by the corresponding option of the theme.

  • 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.

  • pointsize (None or float (default: None)) – The scale of the point size. Actual point cell size is calculated as 500.0 / np.sqrt(adata.shape[0]) * pointsize

  • vmin (float (default: 0)) – The percentage of minimal value to consider.

  • vmax (float (default: 100)) – The percentage of maximal value to consider.

  • sym_c (bool (default: False)) – Whether do you want to make the limits of continuous color to be symmetric, normally this should be used for plotting velocity, jacobian, curl, divergence or other types of data with both positive or negative values.

  • alpha (float (default: 0.8)) – alpha value of the plot

  • edgecolor (str or None (default: None)) – The color of the edge of the dots when type is to be dot.

  • linewidth (str or None (default: None)) – The width of the edge of the dots when type is to be dot.

  • type (str (default: violin)) – The type of the bubble plot, one of {‘violin’, ‘dot’}.

  • figsize (None or [float, float] (default: None)) – The width and height of a figure.

  • sort (str (default: diagnol)) – The method for sorting genes. Not implemented. Need to implement in 2021.

  • transpose (bool (default: False)) – Whether to transpose the row/column of the resulting bubble plot. Gene and cell types are on x/y-axis by default.

  • rotate_xlabel (float (default: horizontal)) – The angel to rotate the x-label.

  • rotate_ylabel (float (default: horizontal)) – The angel to rotate the y-label.

  • save_show_or_return (str {‘save’, ‘show’, ‘return’} (default: show)) – Whether to save, show or return the figure.

  • save_kwargs (dict (default: {})) – 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 arguments passed to plt.scatters or sns.violinplot.

Return type

Nothing but plot the bubble plots.