pegasus.elbowplot

pegasus.elbowplot(data, rep='pca', pval='0.05', panel_size=(6, 4), return_fig=False, dpi=300.0, **kwargs)[source]

Generate Elbowplot and suggest n_comps to select based on random matrix theory (see utils.largest_variance_from_random_matrix).

Parameters
  • data (UnimodalData or MultimodalData object.) – The main data object.

  • rep (str, optional, default: pca) – Representation to consider, either “pca” or “tsvd”.

  • pval (str, optional (default: “0.05”).) – P value cutoff on the null distribution (random matrix), choosing from “0.01” and “0.05”.

  • top_n (int, optional, default: 20) – Only show top_n up/down regulated pathways.

  • panel_size (tuple, optional (default: (6, 4))) – The plot size (width, height) in inches.

  • return_fig (bool, optional, default: False) – Return a Figure object if True; return None otherwise.

  • dpi (float, optional, default: 300.0) – The resolution in dots per inch.

Return type

Optional[Figure]

Returns

  • Figure object – A matplotlib.figure.Figure object containing the dot plot if return_fig == True.

  • Update data.uns

    • {rep}_ncomps: Recommended components to pick.

Examples

>>> fig = pg.elbowplot(data, dpi = 500)