Hovertools decimals in scientific notation

I would like to know how can I set the number of decimal places using scientific notation when I format numbers in Hovertools.

At the moment, if I set hovertools tooltips like (‘value’, ‘@value’) values that are too small are displayed with scientific notation and 3 decimal places. However, if I set tooltips like (‘value’, ‘@value{0.00}’), any value that is smaller than 1e-2, is displayed as zero.

Is there a way to adjust decimal places in scientific notation?


If any of the basic formatting do not meet your requirements, you could consider custom client-side formatting using JavaScript.

See the bokeh reference guide; the CustomJSHover section of the bokeh.models.tools section documents this capability and includes an example.

For your case, you could include logic to use uniform scientific notation everywhere, use mixed scientific notation and fixed-point notation, etc. depending on your preferences/requirements.