# Update non linear solve with sliders (Makie)

**URL:** https://discourse.julialang.org/t/update-non-linear-solve-with-sliders-makie/117767
**Category:** Visualization
**Tags:** question, plotting, makie, nonlinearsolve
**Created:** [August 2, 2024, 3:14pm UTC](https://discourse.julialang.org/t/update-non-linear-solve-with-sliders-makie/117767 "2024-08-02T15:14:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mehdi\_MABED](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mehdi_mabed/32/52904_2.png) [@Mehdi\_MABED](https://discourse.julialang.org/u/Mehdi_MABED)
#### Post date: [August 2, 2024, 3:14pm UTC](https://discourse.julialang.org/t/update-non-linear-solve-with-sliders-makie/117767/1 "2024-08-02T15:14:54Z")

</div>

I would like to plot iwith GLMakie the solution of a non linear equation that I solve with the NonlinearSolve.jl package, but I would like this plot to be updated when I move a slider (the parameter of the equation is linked to this slider, and thus the solution found by NonlinearSolve).

I struggle to find a way : I can’t see how the “lift” command must be used in this case…

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [August 2, 2024, 3:39pm UTC](https://discourse.julialang.org/t/update-non-linear-solve-with-sliders-makie/117767/2 "2024-08-02T15:39:08Z")

</div>

Try starting with something like this and report back with complete code if it doesn’t work:

```julia
using GLMakie, NonlinearSolve

# Lay out the display
fig = Figure()
ax = Axis(fig[1, 1])
sl = Slider(fig[2, 1], range = 0:0.01:10, startvalue = 3)

#define the problem
f(u, p) = u .* u .- p
u0 = [1.0, 1.0]
prob = NonlinearProblem(f, u0, [2])

# solve the problem and put the solution in a ready-to-plot format
points = lift(sl.value) do p
    newprob = remake(prob, p=[p])
    soln = solve(newprob)
    [Point(p, soln.u[1])]
end

# create the plot
scatter!(points, color = :red, markersize = 20)
# reset the limits to ensure the point is visible
limits!(ax, 0, 10, 0, 10)
# display the figure
fig

```
