☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Changing the layout in CustomJS callback for a network graph

Community Supportcustomjsbokehjs
Sandra_Winkelberry
Sandra_Winkelberry

Hello everyone,

I have a network graph with filters that use CustomJS callbacks. When filtering I would like to change the layout of the nodes in the callback.
For my graph I use networkx and the spring_layout.
Once filtered, I would like to rearrange the individual nodes by initializing them in the callback with a new layout. For example with a planar_layout.
Is this possible?

Is it possible to call an external Python script in the callback (For example with Ajax)? So I could change the layout in this script and return it to the callback.

Thank you
Sandra

⌁   Link to post
Bryan
Bryan

I won’t say this is impossible, but I’ve never done that (so can’t offer any concrete advice) or seen anyone else do that, either. This use-case, executing real Python code in callbacks, is pretty much the main motivating reason the Bokeh server exists. Any solution along what you describe is just going to be a partial, untested, reimplementation of the Bokeh server. I think you’d be better either using the Bokeh server, or finding a JavaScript library you can adapt to use in a CustomJS

⌁   Link to post

End of archived discussion · Replies are disabled