# \`InexactError\` in my Plots.jl related script

**URL:** <https://discourse.julialang.org/t/inexacterror-in-my-plots-jl-related-script/105170>\
**Category:** New to Julia\
**Created:** [October 19, 2023, 9:53am UTC](https://discourse.julialang.org/t/inexacterror-in-my-plots-jl-related-script/105170 "2023-10-19T09:53:15Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [October 19, 2023, 12:54pm UTC](https://discourse.julialang.org/t/inexacterror-in-my-plots-jl-related-script/105170/5 "2023-10-19T12:54:03Z")

</div>

I was incorrect when I [suggested](https://discourse.julialang.org/t/problem-in-my-code/105021/2) 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
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
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.)

---

_[View the full topic](https://discourse.julialang.org/t/inexacterror-in-my-plots-jl-related-script/105170)._
