Skip to content

Commit 64e4e9e

Browse files
authored
Merge pull request #86 from automl/bugfix/color-range
Bugfix/color range
2 parents 632748a + 3653743 commit 64e4e9e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix seaborn style name (#82).
55
- Remove potential sources of nondeterminism in evaluators by not setting seeds randomly (#75).
66
- Exchange SMAC log examples to fix issue with PDP (#54).
7+
- Fix error when requesting more than 10 colors in a plot (36 colors available now).
78

89
# Version 1.1.2
910

deepcave/utils/styled_plotty.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ def hex_to_rgb(hex_string: str) -> Tuple[int, int, int]:
6969

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

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

0 commit comments

Comments
 (0)