Skip to content

Commit

Permalink
Merge pull request #86 from automl/bugfix/color-range
Browse files Browse the repository at this point in the history
Bugfix/color range
  • Loading branch information
sarah-segel authored Nov 3, 2023
2 parents 632748a + 3653743 commit 64e4e9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix seaborn style name (#82).
- Remove potential sources of nondeterminism in evaluators by not setting seeds randomly (#75).
- Exchange SMAC log examples to fix issue with PDP (#54).
- Fix error when requesting more than 10 colors in a plot (36 colors available now).

# Version 1.1.2

Expand Down
7 changes: 5 additions & 2 deletions deepcave/utils/styled_plotty.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def hex_to_rgb(hex_string: str) -> Tuple[int, int, int]:

def get_color(id_: int, alpha: float = 1) -> Union[str, Tuple[float, float, float, float]]:
"""
Currently (Plotly version 5.3.1) there are 10 possible colors.
Using Plotly palette for the first 10 ids and Alphabet palette for the next 26, currently 36 colors are possible.
"""
color = px.colors.qualitative.Plotly[id_]
if id_ < 10:
color = px.colors.qualitative.Plotly[id_]
else:
color = px.colors.qualitative.Alphabet[id_ - 10]

r, g, b = hex_to_rgb(color)
return f"rgba({r}, {g}, {b}, {alpha})"
Expand Down

0 comments on commit 64e4e9e

Please sign in to comment.