|
5 | 5 | from collections import OrderedDict |
6 | 6 | from copy import deepcopy |
7 | 7 | from pathlib import Path |
8 | | -from typing import Any, Union |
| 8 | +from typing import Any |
9 | 9 |
|
10 | 10 | import matplotlib.pyplot as plt |
11 | 11 | import numpy as np |
|
14 | 14 | import spatialdata as sd |
15 | 15 | from anndata import AnnData |
16 | 16 | from dask.dataframe import DataFrame as DaskDataFrame |
17 | | -from datatree import DataTree |
18 | 17 | from geopandas import GeoDataFrame |
19 | 18 | from matplotlib.axes import Axes |
20 | 19 | from matplotlib.colors import Colormap, Normalize |
21 | 20 | from matplotlib.figure import Figure |
22 | 21 | from spatialdata import get_extent |
23 | 22 | from spatialdata._utils import _deprecation_alias |
24 | | -from xarray import DataArray |
| 23 | +from xarray import DataArray, DataTree |
25 | 24 |
|
26 | 25 | from spatialdata_plot._accessor import register_spatial_data_accessor |
27 | 26 | from spatialdata_plot.pl.render import ( |
|
62 | 61 | # replace with |
63 | 62 | # from spatialdata._types import ColorLike |
64 | 63 | # once https://github.com/scverse/spatialdata/pull/689/ is in a release |
65 | | -ColorLike = Union[tuple[float, ...], str] |
| 64 | +ColorLike = tuple[float, ...] | str |
66 | 65 |
|
67 | 66 |
|
68 | 67 | @register_spatial_data_accessor("pl") |
@@ -950,7 +949,7 @@ def show( |
950 | 949 | if wanted_labels_on_this_cs: |
951 | 950 | if (table := params_copy.table_name) is not None: |
952 | 951 | colors = sc.get.obs_df(sdata[table], params_copy.color) |
953 | | - if isinstance(colors.dtype, pd.CategoricalDtype): |
| 952 | + if isinstance(colors[params_copy.color].dtype, pd.CategoricalDtype): |
954 | 953 | _maybe_set_colors( |
955 | 954 | source=sdata[table], |
956 | 955 | target=sdata[table], |
|
0 commit comments