sainsc.LazyKDE.plot_KDE ======================= .. py:method:: sainsc.LazyKDE.plot_KDE(*, gene = None, remove_background = False, crop = None, scalebar = True, im_kwargs = dict(), scalebar_kwargs = _SCALEBAR) Plot the kernel density estimate (KDE). By default this will plot the KDE of the total mRNA (:py:attr:`sainsc.LazyKDE.total_mRNA_KDE`). If `gene` is specified the respective KDE will be computed and plotted. :param gene: Gene in :py:attr:`sainsc.LazyKDE.genes` to use for plotting. :type gene: str, optional :param remove_background: If `True`, all pixels for which :py:attr:`sainsc.LazyKDE.background` is `False` are set to 0. :type remove_background: bool, optional :param crop: Coordinates to crop the data defined as `((xmin, xmax), (ymin, ymax))`. :type crop: tuple[tuple[int, int], tuple[int, int]], optional :param scalebar: If `True`, add a ``matplotlib_scalebar.scalebar.ScaleBar`` to the plot. :type scalebar: bool, optional :param im_kwargs: Keyword arguments that are passed to :py:func:`matplotlib.pyplot.imshow`. :type im_kwargs: dict[str, typing.Any], optional :param scalebar_kwargs: Keyword arguments that are passed to ``matplotlib_scalebar.scalebar.ScaleBar``. :type scalebar_kwargs: dict[str, typing.Any], optional :rtype: matplotlib.figure.Figure :raises ValueError: If :py:attr:`sainsc.LazyKDE.total_mRNA_KDE` has not been calculated. .. seealso:: :py:meth:`sainsc.LazyKDE.kde`