Two: Is there any built in function for plotting a scale bar and north arrow on figures, or an easy way to go about generating them? I have hacked up an ugly solution plotting a horizontal line from point A to point B on the map, but ideally it would change scale size based on zoom level - same would go with the north arrow’s location and size.
Is there any built in function for plotting a scale bar and north arrow on figures, or an easy way to go about generating them
There’s nothing currently built in to the library. For things that automatically update as you describe a proper annotation with a BokehJS implementation is needed. Feel free to make an issue on GitHub to discuss for future development. In the more immediately term, you could potentially make a Custom Extension for it.
Excellent thanks. If I find some time I will try to develop something for a scale bar/north arrow. First thing I can think I’d need is a JS callback to get the current figure extents - does this exist?
I’m not quite sure what you are asking for: HTML canvas pixel extents, or pixel extents for the inner plot “frame”, or the data range start/end. Or in what context you want them. If you are implementing a Custom Extension then there is no JS callback in general, there is just the JS code that actually implements the extension.
I’m thinking that if I can get the current x_range and y_range of the figure, I can inform how big to draw the scale bar and what units to use etc. That x_range and y_range changes dynamically with wheel zoom etc. Sorry, I hope that’s clearer.