sainsc.lazykde.LazyKDE.plot_celltype_map

sainsc.lazykde.LazyKDE.plot_celltype_map(*, remove_background=True, crop=None, scalebar=True, cmap='hls', background='black', undefined='grey', scalebar_kwargs=SCALEBAR_PARAMS, return_img=False)

Plot the cell-type annotation.

Parameters:
  • remove_background (bool, optional) – If True, all pixels for which sainsc.LazyKDE.background is False are set to 0.

  • crop (tuple[tuple[int, int], tuple[int, int]], optional) – Coordinates to crop the data defined as ((xmin, xmax), (ymin, ymax)).

  • scalebar (bool, optional) – If True, add a matplotlib_scalebar.scalebar.ScaleBar to the plot.

  • cmap (str or list or dict, optional) – If it is a string it must be the name of a cmap that can be used in seaborn.color_palette(). If it is a list of colors it must have the same length as the number of celltypes. If it is a dictionary it must be a mapping from celltpye to color. Undefined celltypes are plotted according to undefined. Colors can either be provided as string that can be converted via matplotlib.colors.to_rgb() or as (r, g, b)-tuple between 0-1.

  • background (str | tuple[float, float, float]) – Color for the background.

  • undefined (str | tuple[float, float, float]) – Color used for celltypes without a defined color.

  • scalebar_kwargs (dict[str, Any], optional) – Keyword arguments that are passed to matplotlib_scalebar.scalebar.ScaleBar.

  • return_img (bool, optional) – Return the cell-type map as 3D-array (x, y, RGB) instead of the Figure.

Return type:

Figure | ndarray[ubyte]