{ "cells": [ { "cell_type": "markdown", "id": "139a327e-d90c-4817-af53-5fe9477c7527", "metadata": {}, "source": [ "# Plotting" ] }, { "cell_type": "markdown", "id": "c0479951", "metadata": {}, "source": [ "Spatialproteomics has a variety of plotting functions, enabling the plotting of intensities, segmentation masks, and predicted cell type labels." ] }, { "cell_type": "code", "execution_count": 1, "id": "380bdfb5-a16e-4658-8a3a-6dda1efb0312", "metadata": {}, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "\n", "import spatialproteomics\n", "import matplotlib.pyplot as plt\n", "import xarray as xr" ] }, { "cell_type": "code", "execution_count": 2, "id": "233a2fe0-5af1-4e1c-8d15-aca10b87e69d", "metadata": {}, "outputs": [], "source": [ "# loading in a data set and performing some formatting for convenience\n", "ds = xr.open_zarr(\"../../data/BNHL_166_4_I2_LK_2.zarr\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "2a2f43c9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (channels: 56, y: 3000, x: 3000, labels: 8, la_props: 2,\n", " cells: 12560, features: 3)\n", "Coordinates:\n", " * cells (cells) int64 1 2 3 4 5 6 ... 12556 12557 12558 12559 12560\n", " * channels (channels) <U11 'DAPI' 'Helios' 'CD10' ... 'CD79a' 'Ki-67'\n", " * features (features) <U10 '_labels' 'centroid-0' 'centroid-1'\n", " * la_props (la_props) <U6 '_color' '_name'\n", " * labels (labels) int64 1 2 3 4 5 6 7 8\n", " * x (x) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", " * y (y) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", "Data variables:\n", " _image (channels, y, x) uint8 dask.array<chunksize=(7, 375, 750), meta=np.ndarray>\n", " _la_properties (labels, la_props) <U20 dask.array<chunksize=(8, 2), meta=np.ndarray>\n", " _obs (cells, features) float64 dask.array<chunksize=(6280, 3), meta=np.ndarray>\n", " _segmentation (y, x) int64 dask.array<chunksize=(375, 375), meta=np.ndarray>
<xarray.Dataset>\n", "Dimensions: (cells: 12560, channels: 56, features: 4, la_props: 2,\n", " labels: 8, x: 3000, y: 3000)\n", "Coordinates:\n", " * cells (cells) int64 1 2 3 4 5 6 ... 12556 12557 12558 12559 12560\n", " * channels (channels) <U11 'DAPI' 'Helios' 'CD10' ... 'CD79a' 'Ki-67'\n", " * features (features) <U10 '_labels' 'area' 'centroid-0' 'centroid-1'\n", " * la_props (la_props) <U6 '_color' '_name'\n", " * labels (labels) int64 1 2 3 4 5 6 7 8\n", " * x (x) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", " * y (y) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", "Data variables:\n", " _image (channels, y, x) uint8 dask.array<chunksize=(7, 375, 750), meta=np.ndarray>\n", " _la_properties (labels, la_props) <U20 dask.array<chunksize=(8, 2), meta=np.ndarray>\n", " _obs (cells, features) float64 dask.array<chunksize=(6280, 2), meta=np.ndarray>\n", " _segmentation (y, x) int64 dask.array<chunksize=(375, 375), meta=np.ndarray>\n", " _intensity (cells, channels) float64 3.111 0.0 1.391 ... 1.324 0.4174