How can I configure TapTool so it doesn't hide other data points when clicked?

When you click a data point, all other data points are shaded. Is there a way to prevent this?

fig = fig.circle(x, y)

      

Ideally I would like to increase the size of the selected circle. Is it easy to do it?

Update

We can't seem to resize ... according to here :

Only the selection_glyph and nonselection_glyph visual properties are considered for rendering. changes in position, size, etc. will have no effect.

However we can simulate it using a property line_width

, it gets funnier if I combine it with line_dish

.

+3


source to share


1 answer


As with Bokeh 0.9.0, this is a bit awkward for the interface bokeh.plotting

. You need to set non_selection_glyph

the same as the "normal" glyph. Here's a complete example based on the example color_scatter.py

that ships with Bokeh:

import numpy as np

from bokeh.plotting import figure, show, output_file

N = 4000

x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5

TOOLS="pan,wheel_zoom,box_zoom,reset,tap,box_select,lasso_select"

output_file("color_scatter.html")

p = figure(tools=TOOLS)
p.circle(x, y, radius=radii, fill_color="navy", 
         line_color=None, fill_alpha=0.6, name="foo") 

# !!! Here is the part you need. Also note: name="foo" added above !!!
renderer = p.select(name="foo")[0]
renderer.nonselection_glyph=renderer.glyph.clone()

show(p)  # open a browser

      



I made a question on GH to improve this, you can follow it here:

https://github.com/bokeh/bokeh/issues/2414

+4


source







All Articles