Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/color range #86

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading