Skip to content

Fail if color or table do not exist #409

@grst

Description

@grst

When attempting to render_shapes with a color key or a table key that does not exist, spatialdata-plot just plots everything grey. I would expect it to raise a KeyError instead.

Example

# example dataset from tutorial
sdata = sd.read_zarr("visium_brain.zarr/")

(
    sdata.pl.render_images(elements="ST8059050_hires_image")
    .pl.render_shapes(elements="ST8059050", color="doesntexist")
    .pl.show()
)

Image

(
    sdata.pl.render_images(elements="ST8059050_hires_image")
    .pl.render_shapes(elements="ST8059050", color="mt-Co3", table_name="doesntexist")
    .pl.show()
)

Image


Also, somewhat related, the function silently accepts any keyword argument.
For instance, if I mistype table instead of table_name it just uses the default table instead of failing, which can be confusing.


EDIT: again, somewhat related, I'd also expect a failure with corresponding error message that tells me if a region could not be found in the table.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions