Skip to content

UpSet plots do not render when all units were classified for one single reason #355

@nikhilchandra

Description

@nikhilchandra

I previously described this issue in reply to #336 on July 2nd, but decided to submit a a new one here for better compartmentalization.

Briefly, UpSet plot generation fails under specific circumstances, with warnings like these:

Warning: Could not create noise upset plot due to library compatibility: 'Index' object has no attribute 'levels'
Warning: Could not create non-somatic upset plot due to library compatibility: 'Index' object has no attribute 'levels'
Warning: Could not create MUA upset plot due to library compatibility: 'Index' object has no attribute 'levels'

When I first reported this problem, I noted that it stems stems from the upsetplot function from_indicators(), which takes two parameters - metric_display_names and unit_type_data - as inputs. unit_type_data is a pandas DataFrame whose columns correspond to tests that were used in the classification of the unit (I think - please correct me if I'm wrong).

When more than one column in unit_type_data has True values, then from_indicators() returns a DataFrame with a multi-level index (i.e., MultiIndex), and UpSet plot generation works properly. However, should only one column in unit_type_data have True values, then from_indicators() returns a DataFrame with a regular index (type: Index) - this causes UpSet plot generation to break.

I am unsure whether this is expected behavior or bug in the upsetplot package (in which case perhaps we should submit a bug report).

@Julie-Fabre since you have previously been unable to reproduce this problem at your end, I've created a repo here - https://github.com/nikhilchandra/debugging_upset_plots

When you have a moment, perhaps you could clone this project, set up an environment with uv, and run main.py? I think you will quickly see what I'm talking about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions