|
1 | 1 | from __future__ import annotations
|
| 2 | + |
2 | 3 | from collections.abc import Iterable
|
3 |
| -from typing import Callable, Optional, Union, Sequence, NamedTuple |
4 |
| -from matplotlib.cm import get_cmap |
5 | 4 | from copy import copy
|
| 5 | +from functools import partial |
| 6 | +from typing import Callable, NamedTuple, Optional, Union |
| 7 | +from collections.abc import Sequence |
| 8 | + |
6 | 9 | import matplotlib
|
7 | 10 | import matplotlib.patches as mpatches
|
8 | 11 | import numpy as np
|
9 | 12 | import pandas as pd
|
10 | 13 | import spatialdata as sd
|
11 | 14 | import xarray as xr
|
12 |
| -from matplotlib.colors import ListedColormap, to_rgb |
13 |
| -from pandas.api.types import is_categorical_dtype |
14 |
| -from skimage.segmentation import find_boundaries |
15 |
| -from sklearn.decomposition import PCA |
16 |
| -import scanpy as sc |
17 |
| -from pandas.api.types import is_categorical_dtype |
18 |
| -from spatialdata._types import ArrayLike |
19 | 15 | from anndata import AnnData
|
20 |
| -from pandas.api.types import CategoricalDtype |
21 |
| -from matplotlib import colors, patheffects, rcParams |
| 16 | +from matplotlib import colors |
| 17 | +from matplotlib.cm import get_cmap |
22 | 18 | from matplotlib.colors import (
|
23 |
| - ColorConverter, |
24 | 19 | Colormap,
|
| 20 | + ListedColormap, |
25 | 21 | Normalize,
|
26 |
| - TwoSlopeNorm, |
| 22 | + to_rgb, |
27 | 23 | )
|
| 24 | +from pandas.api.types import CategoricalDtype, is_categorical_dtype |
28 | 25 | from skimage.color import label2rgb
|
29 | 26 | from skimage.morphology import erosion, square
|
30 | 27 | from skimage.segmentation import find_boundaries
|
31 | 28 | from skimage.util import map_array
|
32 |
| -from functools import partial |
| 29 | +from sklearn.decomposition import PCA |
| 30 | +from spatialdata._types import ArrayLike |
| 31 | + |
33 | 32 | from ..pl._categorical_utils import _get_colors_for_categorical_obs, _get_palette
|
34 | 33 | from ..pl.utils import _normalize
|
35 | 34 | from ..pp.utils import _get_linear_colormap, _get_region_key
|
36 | 35 |
|
37 |
| - |
38 | 36 | Palette_t = Optional[Union[str, ListedColormap]]
|
39 | 37 | _Normalize = Union[Normalize, Sequence[Normalize]]
|
40 | 38 | _SeqStr = Union[str, Sequence[str]]
|
@@ -221,8 +219,10 @@ def _render_images(
|
221 | 219 |
|
222 | 220 | ax.set_title(key)
|
223 | 221 |
|
| 222 | + |
224 | 223 | import matplotlib.pyplot as plt
|
225 | 224 |
|
| 225 | + |
226 | 226 | def _render_labels(
|
227 | 227 | sdata: sd.SpatialData,
|
228 | 228 | params: dict[str, Union[str, int, float]],
|
|
0 commit comments