Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot plot continuous var values to labels #165

Closed
LucaMarconato opened this issue Sep 29, 2023 · 9 comments · Fixed by #201
Closed

Cannot plot continuous var values to labels #165

LucaMarconato opened this issue Sep 29, 2023 · 9 comments · Fixed by #201
Assignees
Labels
bug Something isn't working priority: high

Comments

@LucaMarconato
Copy link
Member

This code tries to plots the var present in the table in the blobs dataset, which is mapped to the labels.

import spatialdata as sd
from spatialdata.datasets import blobs
import spatialdata_plot
from napari_spatialdata import Interactive

sdata = blobs()

sdata.pl.render_labels('blobs_labels', key='channel_0_sum').pl.show()

# Interactive(sdata)

This is the output produced (tried for all the var_names: 'channel_0_sum', 'channel_1_sum', 'channel_2_sum', but all lead to the same plot)
image

This is the output produced by napari_spatialdata
image
).

@LucaMarconato LucaMarconato added the bug Something isn't working label Sep 29, 2023
@LucaMarconato
Copy link
Member Author

My mistake, I had to use the parameter color, not key. This leads to another bug: AttributeError: 'SpatialImage' object has no attribute 'index'

sdata.pl.render_labels('blobs_labels', color='channel_0_sum').pl.show()
/Users/macbook/embl/projects/basel/spatialdata/src/spatialdata/_core/operations/aggregate.py:244: UserWarning: Converting `region_key: region` to categorical dtype.
  table = TableModel.parse(table, region=shapes_name, region_key=region_key, instance_key=instance_key)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[26], line 8
      4 from napari_spatialdata import Interactive
      6 sdata = blobs()
----> 8 sdata.pl.render_labels('blobs_labels', color='channel_0_sum').pl.show()
     10 # Interactive(sdata)

File ~/embl/projects/basel/spatialdata-plot/src/spatialdata_plot/pl/basic.py:696, in PlotAccessor.show(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)
    689         if is_categorical_dtype(colors):
    690             _maybe_set_colors(
    691                 source=sdata.table,
    692                 target=sdata.table,
    693                 key=params.color,
    694                 palette=params.palette,
    695             )
--> 696     _render_labels(
    697         sdata=sdata,
    698         render_params=params,
    699         coordinate_system=cs,
    700         ax=ax,
    701         fig_params=fig_params,
    702         scalebar_params=scalebar_params,
    703         legend_params=legend_params,
    704     )
    706 if title is not None:
    707     if len(title) == 1:

File ~/embl/projects/basel/spatialdata-plot/src/spatialdata_plot/pl/render.py:448, in _render_labels(sdata, render_params, coordinate_system, ax, fig_params, scalebar_params, legend_params)
    445     instance_id = table.obs[instance_key].values
    447 # get color vector (categorical or continuous)
--> 448 color_source_vector, color_vector, categorical = _set_color_source_vec(
    449     sdata=sdata_filt,
    450     element=sdata_filt.labels[label_key],
    451     element_name=label_key,
    452     value_to_plot=render_params.color,
    453     layer=render_params.layer,
    454     groups=render_params.groups,
    455     palette=render_params.palette,
    456     na_color=render_params.cmap_params.na_color,
    457     alpha=render_params.fill_alpha,
    458 )
    460 if (render_params.fill_alpha != render_params.outline_alpha) and render_params.contour_px is not None:
    461     # First get the labels infill and plot them
    462     labels_infill = _map_color_seg(
    463         seg=label.values,
    464         cell_id=instance_id,
   (...)
    470         na_color=render_params.cmap_params.na_color,
    471     )

File ~/embl/projects/basel/spatialdata-plot/src/spatialdata_plot/pl/utils.py:831, in _set_color_source_vec(sdata, element, value_to_plot, element_name, layer, groups, palette, na_color, alpha)
    826     raise ValueError(
    827         f"Color key '{value_to_plot}' for element '{element_name}' been found in multiple locations: {origins}."
    828     )
    830 if len(origins) == 1:
--> 831     vals = get_values(value_key=value_to_plot, sdata=sdata, element_name=element_name)
    832     color_source_vector = vals[value_to_plot]
    834     # if all([isinstance(x, str) for x in color_source_vector]):
    835     #     raise TypeError(
    836     #         f"Color key '{value_to_plot}' for element '{element_name}' has string values, "
   (...)
    839 
    840     # numerical case, return early

File ~/embl/projects/basel/spatialdata/src/spatialdata/_core/query/relational_query.py:268, in get_values(value_key, element, sdata, element_name)
    266 if sdata is not None:
    267     assert element_name is not None
--> 268     matched_table = match_table_to_element(sdata=sdata, element_name=element_name)
    269     if origin == "obs":
    270         return matched_table.obs[value_key_values]

File ~/embl/projects/basel/spatialdata/src/spatialdata/_core/query/relational_query.py:151, in match_table_to_element(sdata, element_name)
    149 assert element_type in ["labels", "shapes"], f"Element {element_name} ({element_type}) is not supported"
    150 elements_dict = {element_type: {element_name: element}}
--> 151 return _filter_table_by_elements(sdata.table, elements_dict, match_rows=True)

File ~/embl/projects/basel/spatialdata/src/spatialdata/_core/query/relational_query.py:114, in _filter_table_by_elements(table, elements_dict, match_rows)
    112 assert "element" in locals()
    113 assert "name" in locals()
--> 114 n0 = np.setdiff1d(element.index.to_numpy(), table.obs[instance_key].to_numpy())
    115 n1 = np.setdiff1d(table.obs[instance_key].to_numpy(), element.index.to_numpy())
    116 raise ValueError(
    117     f"Instances in the table and in the element don't correspond: found {len(n0)} indices in the "
    118     f"element {name} but not in the table and found {len(n1)} indices in the table but not in the "
    119     "element"
    120 )

File ~/miniconda3/envs/ome/lib/python3.10/site-packages/xarray/core/common.py:278, in AttrAccessMixin.__getattr__(self, name)
    276         with suppress(KeyError):
    277             return source[name]
--> 278 raise AttributeError(
    279     f"{type(self).__name__!r} object has no attribute {name!r}"
    280 )

AttributeError: 'SpatialImage' object has no attribute 'index'

@timtreis
Copy link
Member

timtreis commented Oct 4, 2023

This error is in spatialdata though, I'm fighting with it in like 3 different issues :D

@LucaMarconato
Copy link
Member Author

Apologies, I fixed the bug in get_values() and the PR is now merged scverse/spatialdata#367.
The bug was due to the fact that the labels element contains the background (value 0), but not the table. I fixed this and the values returned by get_values() now never contain the background.

Anyway, this leads to another bug now, which I think it's due to the fact that spatialdata-plot expects a value also for the background.
Can you make your code ignore the background and not display anything for it (like showing a color with alpha = 0)?

Note, to make the task easier, and also to take into account that the labels element could contain non-continuous labels, this new PR (merged) ensures that the dataframe returned by get_values() has the instance_key values in its index. scverse/spatialdata#368

This is the traceback of the new bug:

------------------
ax = plt.gca()
sdata.pl.render_images("blobs_image", cmap="viridis", channel=1).pl.show(ax=ax)
sdata_im.pl.render_labels(color="channel_1_mean", fill_alpha=0.5).pl.show(ax=ax)
------------------
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File /mnt/repos/spatialdata-plot/src/spatialdata_plot/pl/utils.py:899, in _map_color_seg(seg, cell_id, color_vector, color_source_vector, cmap_params, seg_erosionpx, seg_boundaries, na_color)
    898 try:
--> 899     cols = cmap_params.cmap(cmap_params.norm(color_vector))
    900 except TypeError:
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
AssertionError                            Traceback (most recent call last)
Cell In[8], line 3
      1 ax = plt.gca()
      2 sdata.pl.render_images("blobs_image", cmap="viridis", channel=1).pl.show(ax=ax)
----> 3 sdata_im.pl.render_labels(color="channel_1_mean", fill_alpha=0.5).pl.show(ax=ax)
File /mnt/repos/spatialdata-plot/src/spatialdata_plot/pl/basic.py:704, in PlotAccessor.show(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)
    697         if is_categorical_dtype(colors):
    698             _maybe_set_colors(
    699                 source=sdata.table,
    700                 target=sdata.table,
    701                 key=params.color,
    702                 palette=params.palette,
    703             )
--> 704     _render_labels(
    705         sdata=sdata,
    706         render_params=params,
    707         coordinate_system=cs,
    708         ax=ax,
    709         fig_params=fig_params,
    710         scalebar_params=scalebar_params,
    711         legend_params=legend_params,
    712     )
    714 if title is not None:
    715     if len(title) == 1:
File /mnt/repos/spatialdata-plot/src/spatialdata_plot/pl/render.py:508, in _render_labels(sdata, render_params, coordinate_system, ax, fig_params, scalebar_params, legend_params)
    493 color_source_vector, color_vector, categorical = _set_color_source_vec(
    494     sdata=sdata_filt,
    495     element=sdata_filt.labels[label_key],
   (...)
    503     cmap_params=render_params.cmap_params,
    504 )
    506 if (render_params.fill_alpha != render_params.outline_alpha) and render_params.contour_px is not None:
    507     # First get the labels infill and plot them
--> 508     labels_infill = _map_color_seg(
    509         seg=label.values,
    510         cell_id=instance_id,
    511         color_vector=color_vector,
    512         color_source_vector=color_source_vector,
    513         cmap_params=render_params.cmap_params,
    514         seg_erosionpx=None,
    515         seg_boundaries=render_params.outline,
    516         na_color=render_params.cmap_params.na_color,
    517     )
    519     _cax = ax.imshow(
    520         labels_infill,
    521         rasterized=True,
   (...)
    526         # zorder=3,
    527     )
    528     cax = ax.add_image(_cax)
File /mnt/repos/spatialdata-plot/src/spatialdata_plot/pl/utils.py:901, in _map_color_seg(seg, cell_id, color_vector, color_source_vector, cmap_params, seg_erosionpx, seg_boundaries, na_color)
    899         cols = cmap_params.cmap(cmap_params.norm(color_vector))
    900     except TypeError:
--> 901         assert all(colors.is_color_like(c) for c in color_vector), "Not all values are color-like."
    902         cols = colors.to_rgba_array(color_vector)
    904 if seg_erosionpx is not None:
AssertionError: Not all values are color-like.

@LucaMarconato
Copy link
Member Author

Finally in this PR scverse/spatialdata#369, I ensure that for labels, get_values() returns a table whose row are sorted by ascending labels value. Anyway, the safe way to match the returned dataframe to the labels is by looking at the index of the returned dataframe, not by looking at the order.

@LucaMarconato
Copy link
Member Author

Setting medium priority since it shows up in the documentation notebooks.

@LucaMarconato
Copy link
Member Author

LucaMarconato commented Oct 10, 2023

The current error AssertionError: Not all values are color-like is also appearing in the last plot of the mibitof notebook (I have just fixed the bug with get_values() in scverse/spatialdata#376.

@timtreis
Copy link
Member

timtreis commented Oct 11, 2023

I'd love to wait for @Sonja-Stockhaus' #164 to get started on this because we pulled the get_extent refactor on our end into her multi-scale PR because they had quite some otherwise-conflicting overlap. Once that's merged can follow up with a) figuring out if downstream bugs still exist and b) then solve the ones that do.

@LucaMarconato
Copy link
Member Author

Ok perfect, thanks a lot!

@timtreis
Copy link
Member

Update: Issue persists, will tackle next.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File [~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:666](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:666), in _map_color_seg(seg, cell_id, color_vector, color_source_vector, cmap_params, seg_erosionpx, seg_boundaries, na_color)
    [665](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:665) try:
--> [666](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:666)     cols = cmap_params.cmap(cmap_params.norm(color_vector))
    [667](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:667) except TypeError:

TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

AssertionError                            Traceback (most recent call last)
[/Users/tim.treis/Documents/GitHub/spatialdata-plot/test.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/test.ipynb) Cell 2 line <cell line: 7>()
      [3](vscode-notebook-cell:/Users/tim.treis/Documents/GitHub/spatialdata-plot/test.ipynb#X21sZmlsZQ%3D%3D?line=2) import spatialdata_plot
      [5](vscode-notebook-cell:/Users/tim.treis/Documents/GitHub/spatialdata-plot/test.ipynb#X21sZmlsZQ%3D%3D?line=4) sdata = blobs()
----> [7](vscode-notebook-cell:/Users/tim.treis/Documents/GitHub/spatialdata-plot/test.ipynb#X21sZmlsZQ%3D%3D?line=6) sdata.pl.render_labels("blobs_labels", color="channel_0_sum").pl.show()

File [~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:774](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:774), in PlotAccessor.show(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)
    [768](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:768)     if len(wanted_labels_on_this_cs) > 0:
    [769](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:769)         rasterize = (params.scale is None) or (
    [770](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:770)             isinstance(params.scale, str)
    [771](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:771)             and params.scale != "full"
    [772](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:772)             and (dpi is not None or figsize is not None)
    [773](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:773)         )
--> [774](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:774)         _render_labels(
    [775](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:775)             sdata=sdata,
    [776](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:776)             render_params=params,
    [777](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:777)             coordinate_system=cs,
    [778](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:778)             ax=ax,
    [779](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:779)             fig_params=fig_params,
    [780](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:780)             scalebar_params=scalebar_params,
    [781](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:781)             legend_params=legend_params,
    [782](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:782)             rasterize=rasterize,
    [783](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:783)         )
    [785](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:785) if title is None:
    [786](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/basic.py:786)     t = cs

File [~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:593](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:593), in _render_labels(sdata, render_params, coordinate_system, ax, fig_params, scalebar_params, legend_params, rasterize)
    [578](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:578) color_source_vector, color_vector, categorical = _set_color_source_vec(
    [579](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:579)     sdata=sdata_filt,
    [580](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:580)     element=label,
   (...)
    [588](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:588)     cmap_params=render_params.cmap_params,
    [589](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:589) )
    [591](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:591) if (render_params.fill_alpha != render_params.outline_alpha) and render_params.contour_px is not None:
    [592](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:592)     # First get the labels infill and plot them
--> [593](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:593)     labels_infill = _map_color_seg(
    [594](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:594)         seg=label.values,
    [595](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:595)         cell_id=instance_id,
    [596](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:596)         color_vector=color_vector,
    [597](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:597)         color_source_vector=color_source_vector,
    [598](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:598)         cmap_params=render_params.cmap_params,
    [599](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:599)         seg_erosionpx=None,
    [600](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:600)         seg_boundaries=render_params.outline,
    [601](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:601)         na_color=render_params.cmap_params.na_color,
    [602](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:602)     )
    [604](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:604)     _cax = ax.imshow(
    [605](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:605)         labels_infill,
    [606](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:606)         rasterized=True,
   (...)
    [610](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:610)         origin="lower",
    [611](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:611)     )
    [612](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/render.py:612)     _cax.set_transform(trans_data)

File [~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:668](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:668), in _map_color_seg(seg, cell_id, color_vector, color_source_vector, cmap_params, seg_erosionpx, seg_boundaries, na_color)
    [666](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:666)         cols = cmap_params.cmap(cmap_params.norm(color_vector))
    [667](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:667)     except TypeError:
--> [668](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:668)         assert all(colors.is_color_like(c) for c in color_vector), "Not all values are color-like."
    [669](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:669)         cols = colors.to_rgba_array(color_vector)
    [671](https://file+.vscode-resource.vscode-cdn.net/Users/tim.treis/Documents/GitHub/spatialdata-plot/~/Documents/GitHub/spatialdata-plot/src/spatialdata_plot/pl/utils.py:671) if seg_erosionpx is not None:

AssertionError: Not all values are color-like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants