You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with float values that have a very large range of possible values it is very helpful to be able to specify the range with their log values. ipywidgets provides such a slider as FloatLogSlider. Note that the current value is displayed in scientific notation and one can still edit it by clicking on it.
Possible solution(s)
It would be helpful to add such a FloatLogSlider that works as the ipywidgets example and otherwise be identical to the existing FloatSlider.
Alternatively, or perhaps in addition it could be nice to add a scaling function to the FloatSlider which would allow to specify general scaling functions. Just like one often does for image scaling to implement gamma correction, arcsinh, log10, ln, etc. scaling it would be very nice to allow general functions here. E.g. working with a statistical distribution one could make a slider that has a linear response to the percentiles of the distributions making it easier to specify specific values from the distribution.
Some inspiration can be found how matplotlib implements this for color scaling and how powerful the functionality is:
importnumpyasnpimportmatplotlib.pyplotaspltimportmatplotlib.colorsasmcolorsgamma=2.0# Change for different effectsdefgamma_forward(x):
returnnp.power(x, 1/gamma)
defgamma_inverse(x):
returnnp.power(x, gamma)
gamma_norm=mcolors.FuncNorm((gamma_forward, gamma_inverse), vmin=0, vmax=2)
data=np.random.random(size=(100,100))
c=plt.imshow(data, norm=gamma_norm, cmap='inferno')
plt.colorbar(c,shrink=0.5);
It requires us to give both the forward and reverse functions, yet makes it easy and short to specify our custom function.
Adding this functionality to FloatSliderstart and end would be analogous to the vminvmax in the example above.
Alternatives
I have used the ipywidget slider and it works but it cumbersome to keep two different interfaces and call signatures. I currently am using a FloatInput field instead of a slider which works but does take away from the interactivity of the resulting app.
The text was updated successfully, but these errors were encountered:
yipihey
changed the title
LogFloatSlider widget.
FloatLogSlider widget.
Feb 8, 2025
Issue
When working with float values that have a very large range of possible values it is very helpful to be able to specify the range with their log values.
ipywidgets
provides such a slider as FloatLogSlider. Note that the current value is displayed in scientific notation and one can still edit it by clicking on it.Possible solution(s)
It would be helpful to add such a FloatLogSlider that works as the
ipywidgets
example and otherwise be identical to the existing FloatSlider.Alternatively, or perhaps in addition it could be nice to add a scaling function to the FloatSlider which would allow to specify general scaling functions. Just like one often does for image scaling to implement gamma correction, arcsinh, log10, ln, etc. scaling it would be very nice to allow general functions here. E.g. working with a statistical distribution one could make a slider that has a linear response to the percentiles of the distributions making it easier to specify specific values from the distribution.
Some inspiration can be found how
matplotlib
implements this for color scaling and how powerful the functionality is:It requires us to give both the forward and reverse functions, yet makes it easy and short to specify our custom function.
Adding this functionality to FloatSlider
start
andend
would be analogous to thevmin
vmax
in the example above.Alternatives
I have used the ipywidget slider and it works but it cumbersome to keep two different interfaces and call signatures. I currently am using a FloatInput field instead of a slider which works but does take away from the interactivity of the resulting app.
The text was updated successfully, but these errors were encountered: