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

Fail if color or table do not exist #409

Open
grst opened this issue Jan 21, 2025 · 1 comment
Open

Fail if color or table do not exist #409

grst opened this issue Jan 21, 2025 · 1 comment
Labels
enhancement New feature or request priority: medium

Comments

@grst
Copy link
Contributor

grst commented Jan 21, 2025

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.

@LucaMarconato
Copy link
Member

Thanks @grst for reporting. I agree with both.

See also: #392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: medium
Projects
None yet
Development

No branches or pull requests

3 participants