Skip to content

Conversation

JakeWags
Copy link

@JakeWags JakeWags commented Apr 1, 2025

This PR adds the ability to generate semantically useful text descriptions via the python package upset-alttxt developed by the Visualization Design Lab at the University of Utah.

This text description generation is part of a 2025 paper, Accessible Text Descriptions for UpSet Plots.

Generating alt-text in practice

Note: To use this feature, it is necessary to install upset-alttxt separately. This follows the same method as using seaborn in the UpSetPlot package

To generate the alt-text (text description), simply add the gen_grammar boolean flag when initializing the plot. This will populate a grammar for use in the alttxt package. After the plot is initialized, use the get_alt_text() function to fetch the text description for a given plot.

covid_plot = UpSet(
    covid_df,
    subset_size="count",
    sort_by="cardinality",
    sort_categories_by="-cardinality",
    orientation="vertical",
    gen_grammar=True,
)

Additionally, a meta_data flag has been generated which can be used to add contextual information which is usable in the alttxt package or anywhere else it is relevant in the plotting side of things. For example, a user could specify meta_data={"items": "movies"} for a dataset in which each individual item is a movie.

The fetched text description has a short_description, long_description, and technique_description.

An example can be found at examples/plot_alt_text.py. Additionally, a jupyter notebook file showcasing the feature is available as a part of the supplementary material for the paper above.

Note for reviewer/maintainer: On my fork/branch, I consistently have been getting github workflow failures which I do not believe are related to my contributions. Since it seems outside of the scope of the PR, I have abstained from making any changes to these workflows. I am happy to take a look if you deem it necessary however.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant