troutpy.pl.top_bottom_probes

troutpy.pl.top_bottom_probes#

troutpy.pl.top_bottom_probes(sdata, metric, top_n=10, bottom_n=10, title=None, figures_path='', save=False, custom_plot_filename='', palette='Blues')#

Plot a horizontal bar chart of the top and bottom genes for a metric.

Bars are colored based on whether the gene is a control probe or not.

Parameters:
  • sdata (SpatialData) – SpatialData object that contains an xrna_metadata table with a var DataFrame.

  • metric (str) – The metric to sort genes by. Must be a column in sdata["xrna_metadata"].var.

  • top_n (int (default: 10)) – Number of top genes to display.

  • bottom_n (int (default: 10)) – Number of bottom genes to display.

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

  • figures_path (str (default: '')) – Directory path to save the figure.

  • save (bool (default: False)) – Whether to save the figure.

  • custom_plot_filename (str (default: '')) – Custom filename for saving the plot.

  • palette (str (default: 'Blues')) – Color palette name, resolved via troutpy.pl.get_palette(). Falls back to a Matplotlib colormap, then to grey/black, if neither is found.

Return type:

None

Returns:

None