Open ArneDefauw opened 2 weeks ago
so here the colors are not stored in the SpatialData object so there is also no way to have this then show in napari-spatialdata. We would have to double check with storing the colors that we then have the way of making this work. If not this could be a task for the hackathon in Basel next week.
so here the colors are not stored in the SpatialData object so there is also no way to have this then show in napari-spatialdata. We would have to double check with storing the colors that we then have the way of making this work. If not this could be a task for the hackathon in Basel next week.
Hi @melonora in this example, the colors of "new_category" are stored in sdata["table"].uns[ "new_category_colors" ]
, as they are added there through:
sc.pl.umap(sdata.tables["table"], color=["new_category"], show=True)
So in a way, napari-spatialdata could look for "new_category_colors" in .uns. And if not found, fall back to some default cmap.
Note that the 'correct' colors are visible in the scatter widget (because in the background they are probably generated by the same call to sc.pl.umap
- I have not checked the code). So after running the scatter widget, you run into a discripancy between colors visualized there in the umap, and the colors of the annotated labels layer, which could confuse users.
I provide some code to reproduce the issue:
Gives me the umap:
spatialdata-plot
correctly plots the column "new_category":But when I do
I get:
The large cell in the bottom is visualized as having "new_category" '6' with
napari-spatialdata
, whilespatialdata_plot
, correctly plots it as having "new_category" '7'.I am using the latest version of
napari-spatialdata
( 0.5.3 ), and I am using macOS (I do not know if this is relevant, but given https://github.com/scverse/napari-spatialdata/issues/273, it may be).