Hi all,
Is it possible to create the animation of sliding tangent line with Plots?
I got error with my code:
using Plots 
f(x) =  -x^2 + 2x + 2
gradient_line(f, x₀) = (x -> f(x₀) + f'(x₀)*(x-x₀))
plot(f, -3:0.1:5, label = "f(x) = -x² + 2x + 2", xlabel = "x", ylabel = "f(x)");
@gif for i in 1:3
    plot(gradient_line(f, i), -3:0.1:0.5, label = "f'($i)", color = 2);
end
ERROR: LoadError: MethodError: no method matching adjoint(::typeof(f))
Closest candidates are:
**  adjoint(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}) at ~/julia-1.7.3/share/julia/stdlib/v1.7/LinearAlgebra/src/qr.jl:509**
**  adjoint(::Union{LinearAlgebra.Cholesky, LinearAlgebra.CholeskyPivoted}) at ~/julia-1.7.3/share/julia/stdlib/v1.7/LinearAlgebra/src/cholesky.jl:538**
**  adjoint(::LinearAlgebra.Hessenberg) at ~/julia-1.7.3/share/julia/stdlib/v1.7/LinearAlgebra/src/hessenberg.jl:423**
**  …**
Stacktrace:
**  [1] (::var"#17#18"{typeof(f), Int64})(x::Float64)**
**    @ Main ~/LasthrimProjection/plot.jl:4**
**  [2] iterate**
**    @ ./generator.jl:47 [inlined]**
**  [3] _collect**
**    @ ./array.jl:744 [inlined]**
**  [4] collect_similar(cont::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, itr::Base.Generator{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, var"#17#18"{typeof(f), Int64}})**
**    @ Base ./array.jl:653**
**  [5] map(f::Function, A::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64})**
**    @ Base ./abstractarray.jl:2867**
**  [6] _compute_y**
**    @ ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:72 [inlined]**
**  [7] _compute_xyz(x::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, y::Function, z::Nothing, nice_error::Bool)**
**    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:86**
**  [8] macro expansion**
**    @ ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:147 [inlined]**
**  [9] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)**
**    @ RecipesPipeline ~/.julia/packages/RecipesBase/qpxEX/src/RecipesBase.jl:289**
** [10] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)**
**    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/user_recipe.jl:36**
** [11] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)**
**    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/RecipesPipeline.jl:70**
** [12] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)**
**    @ Plots ~/.julia/packages/Plots/lW9ll/src/plot.jl:209**
** [13] plot#145**
**    @ ~/.julia/packages/Plots/lW9ll/src/plot.jl:91 [inlined]**
** [14] macro expansion**
**    @ ~/LasthrimProjection/plot.jl:8 [inlined]**
** [15] top-level scope**
**    @ ~/.julia/packages/Plots/lW9ll/src/animation.jl:235**
** [16] include(fname::String)**
**    @ Base.MainInclude ./client.jl:451**
** [17] top-level scope**
**    @ REPL[1]:1**
in expression starting at /home/browni/LasthrimProjection/plot.jl:7
