bento.pl.density¶
- bento.pl.density(sdata, points_key='transcripts', instance_key='cell_boundaries', kind='hist', hue=None, hue_order=None, shapes=None, hide_outside=True, axis_visible=False, frame_visible=True, title=None, dx=0.1, units='um', square=False, ax=None, shape_kws={}, fname=None, **kwargs)¶
Plot points as 2D density.
- Parameters:
data (SpatialData) – Spatial formatted SpatialData object
kind (str, optional) – Type of density plot, by default “hist”. Options: “hist”, “kde”
hue (str, optional) – Variable name to color points by, by default None
hue_order (list, optional) – Order of hue levels, by default None
shapes (list, optional) – List of shape names to plot, by default None. If None, will plot cell and nucleus shapes by default.
hide_outside (bool, optional) – Whether to hide molecules outside of cells, by default True
title (str, optional) – Title of plot, by default None
dx (float, optional) – Size of scalebar in units, by default 0.1
units (str, optional) – Units of scalebar, by default “um”
square (bool, optional) – Whether to make axis square, by default False
axis_visible (bool, optional) – Whether to show axis, by default False
frame_visible (bool, optional) – Whether to show frame, by default True
ax (matplotlib.axes.Axes, optional) – Axis to plot on, by default None. If None, will use current axis.
sync_shapes (bool, optional) – Whether to synchronize shapes with points, by default True
shape_kws (dict, optional) – Keyword arguments for shapes, by default {}
fname (str, optional) – Filename to save figure to, by default None. If None, will not save figure.