diff --git a/CHANGELOG.md b/CHANGELOG.md index aaeed41e..5e0bf902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/deepcave/utils/styled_plotty.py b/deepcave/utils/styled_plotty.py index e4a0b4db..725ebad4 100644 --- a/deepcave/utils/styled_plotty.py +++ b/deepcave/utils/styled_plotty.py @@ -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})"