`InexactError` in my Plots.jl related script

I was incorrect when I suggested removing the Int would fix the problem because Julia infers the type of the elements anyway. These array constructors both return the same type, so you cannot push! Floats into either. (Only an empty array constructor defaults to Any.)

julia> Int[1]
1-element Vector{Int64}:
 1

julia> [1]
1-element Vector{Int64}:
 1

You would either need to round your results to be integers before pushing, or make the array type such that it can store both Float and Int.

julia> v = Real[1]
1-element Vector{Real}:
 1

julia> push!(v, 1.1)
2-element Vector{Real}:
 1
 1.1

(This error is totally unrelated to Plots.jl. You need to break your problem down into smaller pieces and get those working first before trying to rerun the entire script. Try setting jour=2 and then step through the script in the REPL one line at a time to better understand the problem. You have been told what these errors mean and how to fix them. Now you need to work through your script slowly and implement those fixes as necessary.)

1 Like