Hi, I’d ideally like it if when using the taptool, I could make it select only a single point rather than multiple points, for example if the size is large and there is some overlap between the points. Obviously you wouldn’t normally want to have large points shown that overlap but in my case there’re 10000’s of points and the axis are variably sized so it’s inevitable that there is some overlap. In my code I’ve added some if/else code to check whether multiple points have been selected and if it’s multiple, to drop it down to one. However this still means that this code has to run through which slows it all down a bit, plus it shows all of them, then after a bit shows only one which isn’t as neat and tidy as I’d ideally like it to be. I’ve copied in some example jupyter code below where there’s some overlap between the points and clicking on the data in this region causes it to highlight multiple points.
Therefore my question - is there any way to make taptool select a single point by default (closest to the click point, first, last, whatever)? Same thing applies for the hovertool in fact where it can show multiple sets of information. Thanks very much in advance.
from bokeh.plotting import figure, show,output_notebook from bokeh.models import TapTool output_notebook() x=[1,2,3.5,3.7,3.8,6,7] y=[3,4,3,3.7,3.2,1,2] p=figure() p.scatter(x,y,size=100) p.add_tools(TapTool()) show(p)