Is it possible to set rangeslider limits to use scientific notation?

I have some cases where the numbers in the slider range are quite small, but I only see how to format via numbers, eg “0[.]000”. So I see range limits that display as 0. Can I set a scientific notation format?

Richard

I guess range_slider_name.format = "0.000000" should work. Add/remove zeros after decimal based on how many decimal points you wish to see.

That could be a lot of zeros in my case - I was hoping for something like “0E.00” as a number format option (done as you say via the format attribute)… that would be much more readable.

Any of the same formats here should be usable:

https://docs.bokeh.org/en/latest/docs/reference/models/formatters.html#bokeh.models.formatters.NumeralTickFormatter

The RangeSlider and the NumeralTickFormatter use the same underlying numbro,js library for formatting.

Edit: That said, it doesn’t actually look like numbro.js handles scientific notation. The simplest thing would probably be to just make the slider configurable to use any of the existing tick formatters (some of which do support scientific notation). But that will require new development, so I would suggest making a feature request issue on GitHub

Otherwise in the immediate term I think a custom extension is the only option. There is an example of an extension wrapping the more sophisticated ionRangeSlider in the docs:

https://docs.bokeh.org/en/latest/docs/user_guide/extensions.html

3 Likes

Thanks, Bryan. I’ll follow up on both - though the first is easier :wink:

Richard

1 Like