-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: GH17525 Function _get_standard_colors resets global random seed #17730
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
Changes from 4 commits
3f0db16
6ec894b
f38bf55
831f70f
3bf3c0e
2f3da72
bf9678b
f711dd1
92dbac3
4041102
6e4e3e5
e4f1b0e
54b2138
092c2d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,8 +114,11 @@ def _get_standard_colors(num_colors=None, colormap=None, color_type='default', | |
import random | ||
|
||
def random_color(column): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually just use this
|
||
rstate = random.getstate() # to avoid resetting the seed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Point to the issue number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, since you're changing the behavior, let's document it. A brief doc-string would be good here for future developers. |
||
random.seed(column) | ||
return [random.random() for _ in range(3)] | ||
color = [random.random() for _ in range(3)] | ||
random.setstate(rstate) | ||
return color | ||
|
||
colors = lmap(random_color, lrange(num_colors)) | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference the user visibile issue (e.g. parallel coordinates)?