Is there a way to build dependent sliders with PlutoUI.jl in which adjusting one will dynamically change the others?
Is there a way to build dependent sliders with PlutoUI?
438 views Asked by Ali Rahmjoo At
2
There are 2 answers
0

Here is something that you can try:
using PlutoUI
a = @bind n1 PlutoUI.Slider(0:100)
b = @bind n2 PlutoUI.Slider(0:100, default=n1, show_value=true)
What happens with this is that whenever you change slider a
, that causes b
to be recreated (that's the way that Pluto works). The default setting is linked to the value of a
so moving a
causes b
to appear to move. You can still re-adjust b
to anything you like.
Note that you can't inter-link these two sliders because all cells in Pluto have an order of evaluation with no cycles.
You can simply display the slider multiple times in different cells. These are the same sliders, thus adjusting it in one cell will adjust it also in all other cells.
Example:
This is useful when you need the same UI element at multiple places in your notebook for didactic / usability purposes.