mechanochat.plotting.alphashape_plot3#

mechanochat.plotting.alphashape_plot3(sem: SEM3, vis_key: str | None = None, arr: ndarray[Any, dtype[_ScalarType_co]] | Series | None = None, summary: str = 'receiver_mechano', cid_list: ndarray[Any, dtype[_ScalarType_co]] | None = None, cmap_name: str = 'Reds', palette: Dict[str, Tuple] | None = None, vmax: float | None = None, vmin: float | None = None, boundary_alpha: float = 1, face_alpha: float | List | Tuple = 1, face_alpha_arr: ndarray[Any, dtype[_ScalarType_co]] | None = None, smooth_shape: bool = False, plotter: Plotter | None = None) → Plotter[source]#

Render the reconstructed 3D cell shapes with PyVista.

3D counterpart of alphashape_plot: the alpha-shape meshes in sem.shp_list (built by SEM3.compute_shape) are merged into one PolyData and colored by cell type or by a per-cell value.

Parameters:
  • sem (SEM3) – Subcellular element method object, after compute_shape().

  • 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.

  • summary (str, default 'receiver_mechano') – Where vis_key is looked up in sem.adata: ‘gene’ for gene expression, ‘sender’ / ‘receiver’ / ‘receiver_mechano’ for the corresponding signal DataFrame in .obsm; .obs is used as a fallback.

  • 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 continuous data

  • palette (dict, optional) – Category -> color mapping used for categorical data instead of the colors stored in adata.uns

  • vmax (float, optional) – Colormap upper bound. Default: data max

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

  • boundary_alpha (float, default 1) – Opacity of the mesh edge color

  • face_alpha (float or tuple, default 1) – Face opacity. A (min, max) tuple scales the opacity with the visualized value, so that weak cells fade out

  • face_alpha_arr (ndarray, optional) – Explicit per-cell face opacity, overriding face_alpha

  • smooth_shape (bool, default False) – Subdivide and Taubin-smooth every cell before rendering. Much slower, but removes the faceted look of the raw alpha-shape. Non-manifold cells are only smoothed, not subdivided.

  • plotter (pyvista.Plotter, optional) – Target plotter. A new 1920x1080 notebook plotter is created if None.

Returns:

plotter (pyvista.Plotter) – Call .show() on it to render.