Bokeh 2.1.0.
Is there a way to get callback when user clicks axis? The documentation led me in this direction (below), but none of the callbacks triggered. Minimal example,
There is not currently any built-in mechanism. It could be potentially accomplished with a custom extension. But built-in events currently only respond inside the "plot frame. There are two relevant open issues:
As a possible work-around perhaps one can use the sx/sy co-ordinates from a tap event from the plot. For my purposes, for example, I think I can use those values to know the user is selecting the left y-axis, sx will be a small number.
Add a glyph like a line, line segment, area, patch, or whatever that covers the axis of interest. Set the alpha property(ies) to 0.0; it will be visible to the software and interactions but invisible/transparent to the user.
Add a tap tool with the above-mentioned glyph renderers and a callback that does whatever is needed when that glyph is clicked on / selected.
Sorry for the confusion. You need to add a TapTool and register a callback to deal with the glyphs that get selected by the user interactively clicking on them when the TapTool is active.
The events you have currently in your code are associated with the plot area as mentioned in the reply from @Bryan.
If that’s overly complicated for your use case, your idea about looking at the units (either in data space or screen space) seems like a good one to know if the user clicks in an acceptable vicinity of the axis.