troutpy.pl.histogram

Contents

troutpy.pl.histogram#

troutpy.pl.histogram(sdata, x, hue=None, layer='transcripts', group_key=None, figures_path='', save=True, title=None, custom_plot_filename=None, palette='tab10', bins=30, kde=False)#

Plot histograms of a numeric variable with optional grouping and faceting.

Parameters:
  • sdata (SpatialData) – The input spatial data object.

  • x (str) – The name of the numeric column to plot on the x-axis.

  • hue (Optional[str] (default: None)) – The column name used for color grouping.

  • layer (str (default: 'transcripts')) – The layer in sdata.points to extract data from.

  • group_key (Optional[str] (default: None)) – If provided, creates subplots by the unique values of this column.

  • figures_path (str (default: '')) – Path to save the plot if save is True.

  • save (bool (default: True)) – Whether to save the figure as a PDF.

  • title (Optional[str] (default: None)) – Overall title for the plot.

  • custom_plot_filename (Optional[str] (default: None)) – Custom filename to use when saving the figure.

  • palette (str (default: 'tab10')) – Color palette name for seaborn, resolved via troutpy.pl.get_palette() if not a built-in Matplotlib colormap.

  • bins (int (default: 30)) – Number of histogram bins.

  • kde (bool (default: False)) – Whether to overlay a kernel density estimate.

Return type:

None

Returns:

None