I want to use a slider to set a parameter for an interactive plot. The slider needs to support values from 0.1 to 10. I’m new to Streamlit but I’m thinking there are two good methods.
- A slider where the selection circle moves along a log scaled line.
- A slider which ranges from -1 to 1 but displays (as the end units and the circle position) as 10^x. I can use the slider’s returned value of [-1, 1] to get the required parameter.
To my knowledge there is currently no option for a log scaled line for the slider. Am I wrong about this?
Is there a method to change the values displayed on the slider bar?
If the answer to both of these is no, I would like to make a suggestion for a new argument for the slider bar, line_scale. This could take string arguments for well known functions like “log” or “linear” (default) or take a function. The range and value of slider could be defined as “x” and the accepted function would be of the form fn(x). Then, the developer could specify the function to use and the slider range to get the desired output. The displayed values for the slider limits and slider value as well as the sliders returned value would then be calculated using the provided function.
Using my case as an example, I would set the slider ranges as [-1, 1] and pass to line_scale the function: fn(x): return 10**x.
I’m new to Streamlit and I don’t know how to build new options myself. Is there an example to demonstrate how to create custom widgets?