☰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

Simple Example of CustomJS to Change x_range / y_range?

Community Support
Kyle_Marcroft
Kyle_Marcroft

I have a large number of plots in a figure. Based on user choices, I only have a subset of those plots visible at one time. I have been unable to discern the exactly correct syntax to change the x_range and y_range from inside the CustomJS javascript code. I wish to do this so that the range limits for the two axis make sense based on the visible plots, and are not just autoscaled to the maximum of the invisible plots.

While the functionality to autoscale based on only the visible plots would be nice, I suspect that I have to find and set my own limits each time the set of visible plots changes.

Would someone be able to provide a simple example of how to properly change those values on a figure from within CustomJS? My attempts to crib code from online seem to have no effect.

⌁   Link to post
p-himik
p-himik

There is such functionality! Use DataRange1d(only_visible=True). It should work if you’re using the visible field to hide the renderers, just like an interactive legend does it.

⌁   Link to post

End of archived discussion · Replies are disabled