question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define a default muted glyph

See original GitHub issue

The 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.

screen shot 2018-11-01 at 5 22 11 pm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
GenevieveBuckleycommented, Oct 11, 2020

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

2reactions
virajonecommented, Oct 10, 2020

@bryevdv Hey, I would like to work on this issue. I wanted to know if any work is currently being done on this one ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bokeh plot with initially hidden/muted legend groups
Essentially I want this, but where when the plot loads, some legend entries are already muted or hidden and the ...
Read more >
Interactive legends — Bokeh 2.4.1 Documentation
Other times it is preferable for legend interaction to mute a glyph, instead of hiding it entirely. In this case, set click_policy property...
Read more >
Bokeh - Customising legends - Tutorialspoint
Bokeh - Customising legends, Various glyphs in a plot can be identified by legend ... 5, legend.orientation, set to horizontal (default) or vertical....
Read more >
Python Bokeh tutorial - Interactive Data Visualization with Bokeh
legend.orientation, set to horizontal (default) or vertical ... Glyphs in Bokeh terminology means the basic building blocks of the Bokeh ...
Read more >
Counting characters | Docs | Twitter Developer Platform
We refer to whether a glyph counts as one or more characters as its weight. ... The current version of the configuration file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found