-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
sdata.pl.render_points() fails with scanpy=1.10.4 because the sc.get.obs_df(adata, col_for_color) getter casts col_for_color if it is a str to a list. Easy fix is cast the output to a Series since the output should always a single column in our case.
This was produced with spatialdata-plot=v0.2.7.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/q8/th6r292x7lsf54dm_03pn_7r0000gn/T/ipykernel_96569/361469311.py in ?()
1 blobs = sd.datasets.blobs()
----> 2 blobs.pl.render_points(color="genes", groups="gene_a").pl.show()
/opt/homebrew/Caskroom/mambaforge/base/envs/spatialdata-stable/lib/python3.12/site-packages/spatialdata_plot/pl/basic.py in ?(self, coordinate_systems, legend_fontsize, legend_fontweight, legend_loc, legend_fontoutline, na_in_legend, colorbar, wspace, hspace, ncols, frameon, figsize, dpi, fig, title, share_extent, pad_extent, ax, return_ax, save)
931 sdata, wanted_elements, params_copy, cs, "points"
932 )
933
934 if wanted_points_on_this_cs:
--> 935 _render_points(
936 sdata=sdata,
937 render_params=params_copy,
938 coordinate_system=cs,
/opt/homebrew/Caskroom/mambaforge/base/envs/spatialdata-stable/lib/python3.12/site-packages/spatialdata_plot/pl/render.py in ?(sdata, render_params, coordinate_system, ax, fig_params, scalebar_params, legend_params)
441
442 if col_for_color is not None:
443 cols = sc.get.obs_df(adata, col_for_color)
444 # maybe set color based on type
--> 445 if isinstance(cols.dtype, pd.CategoricalDtype):
446 _maybe_set_colors(
447 source=adata,
448 target=adata,
/opt/homebrew/Caskroom/mambaforge/base/envs/spatialdata-stable/lib/python3.12/site-packages/pandas/core/generic.py in ?(self, name)
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6297 ):
6298 return self[name]
-> 6299 return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'dtype'
Sonja-Stockhaus
Metadata
Metadata
Assignees
Labels
No labels