Skip to content

Commit

Permalink
Merge pull request #77 from visdesignlab/set-divergence-modified
Browse files Browse the repository at this point in the history
Set divergence modified
  • Loading branch information
elizaan authored Sep 17, 2024
2 parents 5a3c87b + f4c1801 commit 060d043
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ no_implicit_reexport = true

[project]
name = "upset-alttxt"
version = "0.4.2"
version = "0.4.3"
description = "Generates alt text for UpSet plots"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
4 changes: 2 additions & 2 deletions src/alttxt/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ class IndividualSetSize(Listable):
Strings need to be kept up-to-date with any changes
to the MultiNet implementation's export format.
"""
IDENTICAL = "identical"

DIVERGINGABIT = "roughly equal"
DIVERGING = "diverging"
DIVERGING = "moderately diverging"
DIVERGINGALOT = "diverging a lot"

class IntersectionTrend(Listable):
Expand Down
10 changes: 5 additions & 5 deletions src/alttxt/tokenmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,16 @@ def calculate_set_divergence(self):
min_set_size = self.sort_visible_sets()[-1][1]

divergence_percentage = (min_set_size / max_set_size) * 100
divergence_percentage = math.ceil(divergence_percentage)

# Determine the divergence category
if divergence_percentage < 26.67:
if divergence_percentage < 30:
return IndividualSetSize.DIVERGINGALOT.value
elif 26.68 <= divergence_percentage <= 53.34:
elif 30 <= divergence_percentage <= 90:
return IndividualSetSize.DIVERGING.value
elif 53.35 <= divergence_percentage <= 79.99:
elif divergence_percentage > 90:
return IndividualSetSize.DIVERGINGABIT.value
else:
return IndividualSetSize.IDENTICAL.value


def calculate_change_trend(self):
"""
Expand Down

0 comments on commit 060d043

Please sign in to comment.