Define a default muted glyph
See original GitHub issueThe bokeh plot.legend.click_policy = 'mute'
doesn’t change the opacity of glyphs.
(The hide
click policy does work well though.)
ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
bokeh version 1.0.1 (I also tried the development installation from master) python version 3.7.1 OS: macOS Mojave version 10.14 (18A391) Browsers:
- Chrome version 69.0.3497.100 (Official Build) (64-bit)
- Firefox version 63.0 (64-bit)
- Safari version 12.0 (14606.1.36.1.9)
Description of expected behavior and the observed behavior
Expected:
…clicking or tapping on the legend entries will hide or mute the corresponding glyph in a plot. These modes are activated by setting the click_policy property on a Legend to either “hide” or “mute”. https://bokeh.pydata.org/en/latest/docs/user_guide/interaction/legends.html
Observed:
The legend click policy ‘mute’ does not alter the opacity of the glyphs in the plot. (The ‘hide’ click policy works well though). This happens to me in a jupyter notebook, standalone html file, and in the bokeh server. It also doesn’t seem related to which browser I use to interact with the plots.
Complete, minimal, self-contained example code that reproduces the issue
import numpy as np
from bokeh.plotting import figure
from bokeh.layouts import row
from bokeh.io import show, output_file
output_file("bokeh_legend_behavior.html")
# Set up some dummy data
glyph_size = 7
n_samples = 100
x1 = np.random.random(n_samples)
y1 = np.random.random(n_samples)
x2 = np.random.random(n_samples)
y2 = np.random.random(n_samples)
x3 = np.random.random(n_samples)
y3 = np.random.random(n_samples)
# Create plots
plot1 = figure(title="Legend click_policy = 'hide'")
plot1.circle(x=x1, y=y1, color='red', legend='Group 1', size=glyph_size)
plot1.square(x=x2, y=y2, color='green', legend='Group 2', size=glyph_size)
plot1.triangle(x=x3, y=y3, color='blue', legend='Group 3', size=glyph_size)
plot1.legend.click_policy = "hide"
plot2 = figure(title="Legend click_policy = 'mute'")
plot2.circle(x=x1, y=y1, color='red', legend='Group 1', size=glyph_size)
plot2.square(x=x2, y=y2, color='green', legend='Group 2', size=glyph_size)
plot2.triangle(x=x3, y=y3, color='blue', legend='Group 3', size=glyph_size)
plot2.legend.click_policy = "mute"
obj = row(plot1, plot2)
show(obj)
Stack traceback and/or browser JavaScript console output
I’m not getting any python or javascript errors/warnings.
Screenshots or screencasts of the bug in action
In the screenshot I’ve clicked on a few of the legend items, and the corresponding glyphs are hidden in the left hand plot (as expected), but I don’t see glyphs with muted opacity in the right hand plot.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (12 by maintainers)
Top GitHub Comments
It’s been a while since there was any discussion here so I would guess that there isn’t anything currently being worked on here. I’d go right ahead and give it a go @virajone
@bryevdv Hey, I would like to work on this issue. I wanted to know if any work is currently being done on this one ?