-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
bokeh server: color palette rgb is not recognized #4096
Comments
This is clearly a bug. @mdk73 is there any JS console output or server output? |
This is the outout I get on the console:
|
What about the browser JavaScript console? |
I am not familiar with the browser development tools, I hope I found the bokeh.min.js?v=50ffae6…:1 Bokeh: setting prefix to / |
That is the correct console, if that's all the output there is, this will require more investigation. The first step would be to see whether RGB tuples work in other contexts (i.e. with |
Actually, quicker/easier thing. Make a server app (i.e. don't usurp |
OK, this version, run as a server app, works on current master:
Can you try running |
When I run this version of the
I get this console output: So my best guess is there is something weird going on with My best suggestion for a workaround, and actually my general advice in any case is to use actual |
The problem is definitely that the string |
I should add, another workaround if you don't to make a server app is to construct RGBA hex values, e.g. |
OK, I definitely think my above hypothesis was correct. Look at: https://github.com/bokeh/bokeh/blob/master/bokeh/core/properties.py#L1813-L1837 Color tuples get serialized to strings like https://github.com/bokeh/bokeh/blob/master/bokeh/core/properties.py#L1832-L1834 In the server it is now a string, which encodes as a There are a few options, any of which you could try to make a PR for, which would be a huge help.
I think the second is safer and easier. Would you be interested in working up a small PR @mdk73? |
I tried to run the script with 'foo.py' with |
I tried to replace the rgb values in the original code with hex values, but I get an error log. The following lines were added to use palette with hex-values (after defining the rgb-palette, before defining the plot: # converting into hex colors
_palette = []
for item in palette:
red = item[0]
green = item[1]
blue = item[2]
alpha = item[3]
hr = format(red, '02x')
hg = format(green, '02x')
hb = format(blue, '02x')
ha = format(int(alpha *255), '02x')
_palette_ = '#{}{}{}{}'.format(hr, hg, hb, ha) # rgba
_palette.append(_palette_)
palette = _palette
print(palette) And the error log:
|
Hex color syntax doesn't support alpha component (we follow CSS3 here). |
We've added a warning to the docs about this issue at #3904 and proposed a few work-arounds:
|
I am like 99% sure the RGBA hex values did used to work... I thought there was actually a drawn-out issue and PR to make them work. |
Also, I specifically think strings starting with "rgb" are not recognized as |
I think it does if you enclose it in a list (similar to how we handle I also removed mention of RGBA hex support in #3904, because it isn't supported in CSS3. |
@bryevdv A number of users have been reporting this because we set the default NaN color to |
@philippjfr There's several intersecting things going on:
TLDR; A PR to make CSS |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The following code plots a few lines with changing color (rgb):
Result:
Now I replace
output_file('rgb-platte.html')
with:to use the bokeh server.
The resulting image has no colors:
The text was updated successfully, but these errors were encountered: