Hello all,
when running the following piece of code, I obtain an error. I have found out that it is due to the fact of using yscale=log10
. If I use yscale=log
there is no problem. In the x
coordinate I have no problem.
# %%
plt = Vector{Layer}(undef, length(ϵ))
g = ["black", "red", "blue", "green", "cyan"]
labels = (e->"ϵ=$e").(ϵ)
println(labels)
length(plt)
# %%
for i = 1:length(ϵ)
ρ_f = rar[i].mass_spline.derivative(1)
r = rar[i].r
ρ=ρ_f(r)
df_plot = (x=r/rₛ, y=ρ./(4*pi*r.^2), grp=fill(labels[i],length(r)))
plt[i]= data(df_plot)*mapping(:x,:y,color=:grp)*visual(Lines, linewidth=4)
end
draw(sum(plt), axis=(xlabel=L"r [r_{\mathrm{Sch}}]",
ylabel=L"$ρ$ [$M_⊙$/kpc³]",
limits=((1.e-1,nothing),(1., nothing)),
xscale=log10, yscale=log10))|> display
The error message is as follows:
ERROR: InexactError: trunc(Int64, NaN)
Stacktrace:
[1] trunc
@ ./float.jl:805 [inlined]
[2] round
@ ./float.jl:369 [inlined]
[3] (::Colon)(start::Float32, step::Float32, stop::Float32)
@ Base ./twiceprecision.jl:434
[4] get_minor_tickvalues(i::IntervalsBetween, scale::typeof(log10), tickvalues::Vector{Float32}, vmin::Float32, vmax::Float32)
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/lineaxis.jl:665
[5] (::Makie.MakieLayout.var"#194#225"{Observable{Vector{Float32}}, Observable{Any}, Attributes})(tickvalues::Vector{Float32}, minorticks::IntervalsBetween)
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/lineaxis.jl:238
[6] (::Observables.OnUpdate{Makie.MakieLayout.var"#194#225"{Observable{Vector{Float32}}, Observable{Any}, Attributes}, Tuple{Observable{Vector{Float32}}, Observable{Any}}})(#unused#::Vector{Float32})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:334
[7] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[8] invokelatest
@ ./essentials.jl:714 [inlined]
[9] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[10] setindex!(observable::Observable{Vector{Float32}}, val::Vector{Float64})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248
[11] (::Makie.MakieLayout.var"#190#221"{Observable{Vector{AbstractString}}, Observable{Vector{Point{2, Float32}}}, Observable{Vector{Float32}}, Observable{Tuple{Float32, Tuple{Float32, Float32}, Bool}}, Observable{Any}, Attributes})(tickvalues_labels_unfiltered::Tuple{Vector{Float64}, Vector{String}}, reversed::Bool)
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/lineaxis.jl:213
[12] (::Observables.OnUpdate{Makie.MakieLayout.var"#190#221"{Observable{Vector{AbstractString}}, Observable{Vector{Point{2, Float32}}}, Observable{Vector{Float32}}, Observable{Tuple{Float32, Tuple{Float32, Float32}, Bool}}, Observable{Any}, Attributes}, Tuple{Observable{Tuple{Vector{Float64}, Vector{String}}}, Observable{Any}}})(#unused#::Tuple{Vector{Float64}, Vector{String}})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:334
[13] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[14] invokelatest
@ ./essentials.jl:714 [inlined]
[15] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[16] setindex!(observable::Observable{Tuple{Vector{Float64}, Vector{String}}}, val::Tuple{Vector{Float64}, Vector{String}})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248
[17] (::Observables.MapUpdater{Makie.MakieLayout.var"#189#220", Tuple{Vector{Float64}, Vector{String}}})(::Tuple{Float32, Tuple{Float32, Float32}, Bool}, ::Vararg{Any})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:372
[18] (::Observables.OnUpdate{Observables.MapUpdater{Makie.MakieLayout.var"#189#220", Tuple{Vector{Float64}, Vector{String}}}, Tuple{Observable{Tuple{Float32, Tuple{Float32, Float32}, Bool}}, Observable{Any}, Observable{Any}, Observable{Any}, Observable{Any}}})(#unused#::Tuple{Float32, Float32})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:334
[19] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[20] invokelatest
@ ./essentials.jl:714 [inlined]
[21] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[22] setindex!
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248 [inlined]
[23] (::Observables.var"#3#4"{Any, Observable{Any}})(value::Tuple{Float32, Float32})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:58
[24] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[25] invokelatest
@ ./essentials.jl:714 [inlined]
[26] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[27] setindex!
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248 [inlined]
[28] (::Makie.MakieLayout.var"#268#299"{Observable{Tuple{Float32, Float32}}, Observable{Tuple{Float32, Float32}}})(lims::GeometryBasics.HyperRectangle{2, Float32})
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:207
[29] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[30] invokelatest
@ ./essentials.jl:714 [inlined]
[31] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[32] setindex!
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248 [inlined]
[33] adjustlimits!(la::Axis)
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:890
[34] #282
@ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:446 [inlined]
[35] (::Observables.OnUpdate{Makie.MakieLayout.var"#282#315"{Axis}, Tuple{Observable{GeometryBasics.HyperRectangle{2, Int64}}, Observable{GeometryBasics.HyperRectangle{2, Float32}}}})(#unused#::GeometryBasics.HyperRectangle{2, Float32})
@ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:334
[36] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[37] invokelatest
@ ./essentials.jl:714 [inlined]
[38] notify
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
[39] setindex!
@ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248 [inlined]
[40] reset_limits!(ax::Axis; xauto::Bool, yauto::Bool, zauto::Bool)
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:546
[41] reset_limits!
@ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:471 [inlined]
[42] plot!(::Axis, ::Type{Lines}, ::Attributes, ::Vector{Float64}, ::Vararg{Vector{Float64}}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:699
[43] plot!
@ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:688 [inlined]
[44] #plot!#340
@ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:705 [inlined]
[45] plot!(ae::AxisEntries)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/aCs1Y/src/entries.jl:75
[46] foreach(f::typeof(plot!), itr::Matrix{AxisEntries})
@ Base ./abstractarray.jl:2694
[47] plot!(fig::Figure, s::AlgebraOfGraphics.Layers; axis::NamedTuple{(:xlabel, :ylabel, :limits, :xscale, :yscale), Tuple{LaTeXStrings.LaTeXString, LaTeXStrings.LaTeXString, Tuple{Tuple{Float64, Nothing}, Tuple{Float64, Nothing}}, typeof(log10), typeof(log10)}}, palettes::NamedTuple{(), Tuple{}})
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/aCs1Y/src/draw.jl:22
[48] (::AlgebraOfGraphics.var"#237#238"{NamedTuple{(:xlabel, :ylabel, :limits, :xscale, :yscale), Tuple{LaTeXStrings.LaTeXString, LaTeXStrings.LaTeXString, Tuple{Tuple{Float64, Nothing}, Tuple{Float64, Nothing}}, typeof(log10), typeof(log10)}}, NamedTuple{(), Tuple{}}, NamedTuple{(), Tuple{}}, NamedTuple{(), Tuple{}}, NamedTuple{(), Tuple{}}, AlgebraOfGraphics.Layers})(f::Figure)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/aCs1Y/src/draw.jl:46
[49] update
@ ~/.julia/packages/AlgebraOfGraphics/aCs1Y/src/draw.jl:10 [inlined]
[50] #draw#236
@ ~/.julia/packages/AlgebraOfGraphics/aCs1Y/src/draw.jl:45 [inlined]
I would appreciate any help with this.