slice#

slice(grid: SupPlotsSpec, index: int | Sequence[int], **kwargs) PlotSpec | SupPlotsSpec | None#

Slice a grid object (SupPlotsSpec) with the given index.

Parameters:
Returns:

PlotSpec | SupPlotsSpec – The sliced grid.

Raises:

TypeError – If the grid is not a SupPlotsSpec object. If the index is not an int or Sequence[int].

Examples

Get a single plot from a grid.

import scanpy as sc
from lets_plot import *

import cellestial as cl

data = sc.read_h5ad("data/pbmc3k_pped.h5ad")

grid = cl.expressions(
    data,
    keys=["MALAT1", "YBX3", "MNDA" ,"HLA-DRA"],
    axis_type="arrow",
    color_high="red",
    ncol=2,
)

cl.slice(grid, index=3)

Get a multiple plots from a grid.

import scanpy as sc
from lets_plot import *

import cellestial as cl

data = sc.read_h5ad("data/pbmc3k_pped.h5ad")

grid = cl.expressions(
    data,
    keys=["MALAT1", "YBX3", "MNDA" ,"HLA-DRA"],
    axis_type="arrow",
    color_high="red",
    ncol=2,
)

cl.slice(grid, index=[1,3])