[BUG] BoxAnnotation doesn't respect fill_color=None
See original GitHub issueALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Bokeh 2.0.0 | Python 3.7 | Firefox 74.0 | Windows 10 build 16299.1747
Description of expected behavior and the observed behavior
Expected behavior: Glyphs generally support turning off fill by supplying a fill_color
value of None
. Would expect the same from BoxAnnotation
.
Observed behavior: BoxAnnotation
(and maybe others? haven’t tested) instead appears to have a white fill with a low (but nonzero) alpha under these conditions. Setting fill_alpha
to zero has the desired effect, but this is not my standard usage pattern for turning off fill, and it should probably be consistent anyway.
Complete, minimal, self-contained example code that reproduces the issue
import bokeh.plotting
import bokeh.models
bokeh.plotting.output_file("box_annotation_test.html")
fig = bokeh.plotting.figure(width=500, height=500, x_range=[0, 3], y_range=[0,3])
fig.circle(x=[1, 1, 2, 2], y=[1, 2, 1, 2], size=100, line_color=None, fill_color="Red")
ba = bokeh.models.BoxAnnotation(bottom=1, top=2, left=1, right=2, line_color="Blue",
line_dash="dotted", fill_color=None)
fig.add_layout(ba)
bokeh.plotting.save(fig)
Screenshots or screencasts of the bug in action
The BoxAnnotation
is drawn between the centers of the red circles. Notice the “notches” of paler red where the box intersects them.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Line and fill visuals should be considered independently, the same way as glyphs work. Essentially you have to replace:
with
and similarly change
line
visuals.The tricky bit is that annotations have both canvas and CSS modes. This code only handles to former and you will have to figure out the later.
Right, it’s currently not explicitly checking for
null
condition on the JS side, so it is rendering “null” color with a default opacity of 0.4 (whatever canvas defines that to do). For now you can addfill_alpha=0
as a workaround:Since it should be a simple fix and since there a a workaround I will leave it for now a
Good First Issue