Hi all,
I have run this code smoothly yesterday, but it can’t be run anymore, it triggers an error
UndefVarError: Point2f not defined
Stacktrace:
** [1] (::var"#1#3"{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}})(a::Float64, b::Float64)**
** @ Main ./In[1]:12**
** [2] lift(f::Function, o1::Observable{Any}, rest::Observable{Any}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})**
** @ Makie ~/.julia/packages/Makie/NL7Xw/src/interaction/nodes.jl:13**
** [3] lift(f::Function, o1::Observable{Any}, rest::Observable{Any})**
** @ Makie ~/.julia/packages/Makie/NL7Xw/src/interaction/nodes.jl:10**
** [4] quadraticsliders(x::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64})**
** @ Main ./In[1]:11**
** [5] quadraticsliders()**
** @ Main ./In[1]:4**
** [6] top-level scope**
** @ In[1]:24**
** [7] eval**
** @ ./boot.jl:373 [inlined]**
** [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)**
** @ Base ./loading.jl:1196**
I wonder how to make it works
- I have tried add using Meshes, not working
using GLMakie
function quadraticsliders(x=-5:0.01:5)
fig = Figure()
ax = Axis(fig[1, 1], xlabel="X", ylabel="Y")
sl_a = Slider(fig[2, 1], range = -3:0.01:3, startvalue = 0.)
sl_b = Slider(fig[1, 2], range = -3:0.01:3, horizontal = false, startvalue = 0.)
points = lift(sl_a.value, sl_b.value) do a, b
Point2f.(x, a.*x.^2 .+ b.*x)
end
l = lines!(points, color = :blue)
onany((a,b)->axislegend(ax, [l], ["$(a)x² + $(b)x"]), sl_a.value, sl_b.value)
limits!(ax, minimum(x), maximum(x), -10, 10)
fig
end
quadraticsliders()