scmagnify.plotting.barplot#
- scmagnify.plotting.barplot(data, modal='GRN', key='regulon_scores', n_top=5, cmap='Blues', xlabel='Score', ylabel='Gene', swap_df=False, figsize=None, dpi=300, nrows=None, ncols=3, wspace=0.4, hspace=0.4, sharex=False, sharey=False, context='notebook', default_context=None, theme='whitegrid', font_scale=1, show=None, save=None, **kwargs)#
Plot top features per group as bar charts.
- Parameters:
data (
AnnData|MuData|GRNMuData) – Single cell data object. Can be ananndata.AnnData,mudata.MuData,scmagnify.GRNMuDatamodal (
Literal['GRN','RNA','ATAC'] (default:'GRN')) – Modality key (e.g., ‘RNA’, ‘ATAC’) when using multi-modal data.mudata.MuDataorscmagnify.GRNMuDatamust be provided.key (
str(default:'regulon_scores')) – Key in.varmto retrieve the DataFrame.n_top (
int(default:5)) – Number of top features per group.cmap (
str(default:'Blues')) – Colormap name or object. Seematplotlib.cm.xlabel (
str|None(default:'Score')) – Label for the x-axis. If None, use the feature name.ylabel (
str|None(default:'Gene')) – Label for the y-axis. If None, use “Gene”.swap_df (
bool(default:False)) – If True, transpose the DataFrame before plotting.figsize (
Optional[tuple] (default:None)) – Figure size in inches (width, height). Seematplotlib.figure.Figure.dpi (
int(default:300)) – Dots per inch (resolution) of the figure. Seematplotlib.figure.Figure.nrows (
Optional[int] (default:None)) – Number of subplot rows. If None, it will be calculated automatically.ncols (
int|None(default:3)) – Number of subplot columns. If None, it will be calculated automatically.wspace (
float|None(default:0.4)) – Width space between subplots. Seematplotlib.pyplot.subplots().hspace (
float|None(default:0.4)) – Height space between subplots. Seematplotlib.pyplot.subplots().sharex (
bool|None(default:False)) – If True, subplots will share the x-axis. Seematplotlib.pyplot.subplots().sharey (
bool|None(default:False)) – If True, subplots will share the y-axis. Seematplotlib.pyplot.subplots().context (
str|None(default:'notebook')) – Seaborn context, e.g., ‘notebook’, ‘paper’. Seeseaborn.set_context().default_context (
Optional[dict] (default:None)) – If True, reset to default seaborn context before plotting.theme (
str|None(default:'whitegrid')) – Theme name or rcParams overrides. Seeseaborn.set_theme().font_scale (
float|None(default:1)) – Scale factor applied to fonts for the plot. Seeseaborn.set_context().show (
Optional[bool] (default:None)) – Whether to display the figure. IfNone, the figure will be shown by default.save (
Optional[str] (default:None)) – Whether to save the figure. IfTrue, the figure is saved to a file using thewritekey. If astris provided, it is used as the filename, potentially overriding other settings. IfNoneorFalse, the figure is not saved.
- Returns:
matplotlib.figure.Figure | None Figure when
showis False, otherwise None.