cellrefiner.pl.plot_cell_shape

cellrefiner.pl.plot_cell_shape(sem, vis_key=None, arr=None, summary='sender', compute_alphashape=False, cid_list=None, cmap_name='Reds', vmax=None, vmin=None, boundary_width=1, boundary_color=None, boundary_alpha=1, face_alpha=1, show_axis=False, enable_annotation=False, enable_legend=True, enable_colorbar=True, ax=None, save_name=None, **kwargs)[source]

Plot cell shape using alpha shape, visualize cell data by colors.

Parameters:
  • sem (SEM) – Subcellular element method object

  • vis_key (str, optional) – Key to retrieve visualization data from sem.adata

  • arr (np.ndarray or pd.Series, optional) –

    Data for visualization. shape = (nc,) or (len(cid_list),)

    Ignored if vis_key is provided .

    sem.ctype will be visualized if arr and vis_key both are not provided.

  • compute_alphashape (bool, default=False) – Compute alphashape if True

  • cid_list (ndarray, optional) – Array of index for cells to be visualized. Default: all cells

  • cmap_name (str, default='Reds') – Valid matplotlib colormap name to visualize data

  • vmax (float, optional) – Colormap upper bound. Default: 95th percentile for positive data

  • vmin (float, optional) – Colormap lower bound. Default: data min

  • boundary_width (float, default=1) – Cell boundary line width

  • boundary_color (str or tuple, optional) – Cell boundary line color, Default: matches face color

  • boundary_alpha (float, default=1) – Cell boundary line opacity, 0 (fully transparent), 1 (fully opaque)

  • face_alpha (float, default=1) – Cell shape face opacity, 0 (fully transparent), 1 (fully opaque)

  • show_axis (bool, default=False) – Show axis

  • enable_annotation (bool, default=False) – Annotate cells with index at centroids

  • enable_legend (bool, default=True) – Show categorical legend (only for category data)

  • enable_colorbar (bool, default=True) – Show colorbar (only for continuous data)

  • ax (Axes, optional) – Target matplotlib axes object. Creates new figure if None.

  • save_name (str, optional) – Output path for figure saving (e.g., ‘figure.pdf’)

  • **kwargs – keyword arguments passed to sem.compute_alphashape()

Returns:

ax

Return type:

Axes

Examples

>>> cr.pl.plot_cell_shape(sem)