Skip to content

Plotting shapes with colouring by table.obs column (categorical as string) does not work #499

@Pigrenok

Description

@Pigrenok

I have a very simple example. I have a cropped spatialdata object

test.zarr.tar.gz

I am trying to plot shapes 'nucleus_boundaries' with colouring by 'ident_add' column from 'table'. But I get all shapes in grey colour.

Interestingly, if I use another shapes, which is related to another table (not in this example sdata object, but in a larger one, from which this was extracted), it works fine with cropping (using polygon query).

In that full sdata object there are shapes which are related to 'table' (generated by baysor segmentation) and 'nucleus_boundaries' related to 'old table'. Here though, I tried to not filter table and set table_name to old_table. Did not work. Tried to move 'old_table' to 'table' and removed table_name parameter from render_shapes. Then I filtered 'table'

anndata = sdata_cropped['table']
sdata_cropped['table'] = anndata[sdata_cropped['nucleus_boundaries'].index]

and then tried to plot as follows:

sdata_cropped.pl.render_shapes('nucleus_boundaries', color='ident_add', table_name='table').pl.show()

And get the following

Image

Am I doing something wrong or is there a bug somewhere in the plotting routine? What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions