Programmatically change location (coordinates) of point added by pointdrawtool

Hi,

I would like change the coordinates/location of a point added by the pointdrawtool before it is rendered in the plot. How could I achieve this?

OR I could add the point, make the glyph invisible, and then programmatically update the x/y coordinates in the data source, and make the glyph (point) visible again. I have this method working but changes are not displayed visually on the plot. The point remains in the original location…

Thanks

@beder A little more context is necessary, e.g. do you mean to update from JavaScript code (in a CustomJS callback)? Or do you mean to update from Python code (in a Bokeh server app)?

Yep, Updating from python code in a bokeh server app

If you haven’t already, you might open the browser’s JS console and see if you’re getting any errors when the point isn’t moving as expected.

Would you like to provide some example code for your update method, so that reviewers can run it and reproduce the error?

Hi, I would be happy to supply some example code. However, I think in order to give a decent example, I need to include a python version of source.change.emit(). Is there one?

There is not, you can trigger an event on the source by assigning a new value to .data. (or calling stream or patch on the data source).

I see. Thanks for that information. I’ll do some more work and try to post some example code later today.