Logarithmic-scale slider


first of all, Streamlit is unarguably amazing!

I would be interested for a logarithmic-scale slider value, such as

st.log_slider(‘My log slider’, a, b, value, step, base), that would go from base^a to base^b my multiplying by the factor base^step, with a default value base^value.

One way might be to use the real slider like so:
log_slider = np.log(st.slider(…)) but to change the number displayed by the slider from the real value to base b log of the value.

Another way would be to create a new slider, for instance with Streamlit components.

If you have any clue on how to do this, it might be useful to the community, for instance for learning rate sliders.

Thank you by advance and thanks to all Streamlit developers for

1 Like

Hi @nathanetourneau, welcome to the Streamlit community. Glad you’re getting value from the project!

A PR was merged yesterday that could provide a similar functionality:

In that case, you could pass an iterable having the values you want, and they would show in the slider. It’s still going to show them as equal spacing on the slider though, so if you wanted to change the spacing to logarithmic as well, then you’d probably need to make a Streamlit component. Or make a feature request, but a Streamlit component would likely get implemented quicker :slight_smile: