You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to plot a categorical column (say key) of sdata.tables[table_name].obs using spatialdata-plot, colors specified in sdata.tables[table_name].uns[ "{key}_colors" ] are ignored due to this line:
When trying to plot a categorical column (say
key
) ofsdata.tables[table_name].obs
using spatialdata-plot, colors specified insdata.tables[table_name].uns[ "{key}_colors" ]
are ignored due to this line:spatialdata-plot/src/spatialdata_plot/pl/utils.py
Line 758 in 478ab27
This PR fixes this;
#413
Minimal example to reproduce the issue:
With the small fix this gives
I've added a unit test which reproduces the issue in the PR https://github.com/ArneDefauw/spatialdata-plot/blob/5af65aa118f7abf87e47470038ecdbddb27ef1ca/tests/pl/test_render_labels.py#L217
As explained in the PR, I've stumbled upon an issue when trying to plot a subset of the data, trying to maintain the same colors, see https://github.com/ArneDefauw/spatialdata-plot/blob/5af65aa118f7abf87e47470038ecdbddb27ef1ca/tests/pl/test_render_labels.py#L225.
Starting from the code above, if we do:
we get:
while we expect
This issue is caused by https://github.com/scverse/spatialdata/blob/03d3be80fad69ff54097e90a9e80ad02e9e0e242/src/spatialdata/_utils.py#L203.
There is a workaround for this:
as documented here https://github.com/ArneDefauw/spatialdata-plot/blob/5af65aa118f7abf87e47470038ecdbddb27ef1ca/tests/pl/test_render_labels.py#L250, but this should probably be documented somewhere public.
The text was updated successfully, but these errors were encountered: