Skip to content

Categorical color obs column crashes the plotting #355

Description

@sinanugur

Hi,

When the "color" is categorical, it crashes and returns ValueError in version 0.2.6. The categorial "test" column contains NaN values. There are 11 possible categories.

This code was working perfectly in version 0.2.4.

Cheers,

sdata_small.pl.render_images("queried_cytassist",alpha=1).pl.render_shapes(
            f"{sample_id}_square_00{bin_size}um", color="test",method="matplotlib"
        ).pl.show(coordinate_systems="global", title="Test clusters", legend_fontsize=8,figsize=(10,10),dpi=200,save=None)
[359](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:359)             "Could not convert values in the `color` column to float, if `color` column represents"
    [360](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:360)             " categories, set the column to categorical dtype."
    [361](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:361)         ) from e

TypeError: '<' not supported between instances of 'str' and 'float'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions