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')#

Creates a horizontal bar plot showing the top and bottom genes based on a specified metric. Bars are colored based on whether the gene is a control probe or not.

Parameters:
  • sdata (spatialdata.SpatialData) – SpatialData object that contains ‘xrna_metadata’ with ‘var’ DataFrame.

  • metric (str) – The metric to sort genes by. Must exist as a column in sdata[‘xrna_metadata’].var.

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

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

  • title (str) – Title for the plot.

  • save (bool) – Whether to save the figure.

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

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

  • palette (str) – Color palette name. First tries troutpy palettes, then matplotlib colormaps, else fallback to defaults.

Return type:

None