Reputation:
In ipywidgets
, how do I use scientific notation for large values of slider? Say if I have something like:
FloatSlider(min=1e7, max=1e9, step=1e7)
The display on the slider would be full of zeros. Can I somehow switch that to a scientific notation?
Upvotes: 1
Views: 1254
Reputation: 28405
If you read the help you will find a section saying:
readout_format : str
default is '.2f', specifier for the format function used to represent
slider value for human consumption, modeled after Python 3's format
specification mini-language (PEP 3101).
So:
FloatSlider(min=1e7, max=1e9, step=1e7, readout_format='.2e')
should do the job.
Upvotes: 1