# StackOverflowError with boxplot!() due to deprecation

**URL:** <https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871>\
**Category:** General Usage\
**Tags:** question, plotting\
**Created:** [August 13, 2020, 1:09pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871 "2020-08-13T13:09:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![1634](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/1634/32/12119_2.png) [@1634](https://discourse.julialang.org/u/1634)\
**Post date:** [August 13, 2020, 1:09pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/1 "2020-08-13T13:09:15Z")

</div>

I’d like to have boxplot only considering non-missing data ignoring row informations.

```julia
using StatsPlots
a=[ 0.000163187 0.000121895 0.000229244 6.98374e-6
         missing missing missing missing
        0.000347736 0.000385244 0.00025956 missing]

function boxplot_missing(x::Any, y::Array{Union{Missing, Float64}})
    for i in 1:size(y,2)
        plot_y = filter(!ismissing, y[:,i])
        if i==1
            bp=boxplot([i],plot_y)
        else
            boxplot!([i],plot_y)
        end
    end
    display(bp)
end

boxplot_missing(1:4, a)

```

but get the error. When I click in the .\boot.jl and .\array.jl, it’s reported to be deprecated by Atom. I ran out of ideas on what I can work on. Any suggestions are much appreciated.

```julia
ERROR: StackOverflowError:
Stacktrace:
 [1] Array at .\boot.jl:405 [inlined]
 [2] Array at .\boot.jl:414 [inlined]
 [3] similar at .\array.jl:361 [inlined]
 [4] similar at .\abstractarray.jl:626 [inlined]
 [5] _unsafe_getindex(::IndexLinear, ::Array{Union{Missing, Float64},1}, ::Base.Slice{Base.OneTo{Int64}}, ::Int64) at
.\multidimensional.jl:739
 [6] _getindex at .\multidimensional.jl:727 [inlined]
 [7] getindex at .\abstractarray.jl:980 [inlined]
 [8] boxplot(::Array{Int64,1}, ::Array{Union{Missing, Float64},1}) at H:\julia\ngsJulia\ngsPool\compare\compare_ngsPool_snape.jl:138
 [9] boxplot(::Array{Int64,1}, ::Array{Union{Missing, Float64},1}) at H:\julia\ngsJulia\ngsPool\compare\compare_ngsPool_snape.jl:140 (repeats 21741 times)
 [10] boxplot_missing(::UnitRange{Int64}, ::Array{Union{Missing, Float64},2}) at H:\julia\ngsJulia\ngsPool\compare\compare_ngsPool_snape.jl:140
 [11] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 13, 2020, 1:24pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/2 "2020-08-13T13:24:16Z")

</div>

I’ve got another error, so I rearranged (quick and dirty) your code a bit and this seems to work as expected (Julia 1.5):

```julia
function boxplot_missing(x::Any, y::Array{Union{Missing, Float64}})
	i=1
    plot_y = filter(!ismissing, y[:,i])
    bp=boxplot([i],plot_y)
    for i in 2:size(y,2)
		plot_y = filter(!ismissing, y[:,i])
		bp=boxplot!([i],plot_y)
    end
    display(bp)
end

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 13, 2020, 1:31pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/3 "2020-08-13T13:31:10Z")

</div>

By the way: x is not used… and some other minor details off topic 🙂

---

<div class="post-metadata">

**Author:** ![1634](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/1634/32/12119_2.png) [@1634](https://discourse.julialang.org/u/1634)\
**Post date:** [August 13, 2020, 1:34pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/4 "2020-08-13T13:34:42Z")

</div>

Thanks, I tried your codes but still got the same errors. Mine is Julia Version 1.4.0.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 13, 2020, 1:36pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/5 "2020-08-13T13:36:37Z")

</div>

I tried in 1.4.2 and it works. Is this an oppurtunity to upgrade?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 13, 2020, 1:48pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/6 "2020-08-13T13:48:58Z")

</div>

Some minor rework:

```julia

using StatsPlots

function boxplot_missing(m)
    bp=boxplot()
    for i in 1:size(m,2)
		bp=boxplot!(filter(!ismissing,m[:,i]))
    end
    display(bp)
end

a=[ 0.000163187 0.000121895 0.000229244 6.98374e-6
	missing missing missing missing
	0.000347736 0.000385244 0.00025956 missing]
			   
boxplot_missing(a)

```

Works in Julia 1.3.1, 1.4.2 and 1.5.0.

---

<div class="post-metadata">

**Author:** ![1634](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/1634/32/12119_2.png) [@1634](https://discourse.julialang.org/u/1634)\
**Post date:** [August 13, 2020, 1:49pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/7 "2020-08-13T13:49:10Z")

</div>

> [@oheil](#):
>
> Works in Julia 1.3.1, 1.4.2 and 1.5.0.

Thanks for the information and your time.

> [@oheil](#):
>
> some other minor details off topic

Could you specify a bit, if at your convenience? I used ::Any to cope with uncertain input including 1:4 or other vector. May I know your suggestion?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 13, 2020, 1:49pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/8 "2020-08-13T13:49:38Z")

</div>

> [@1634](#):
>
> Could you specify a bit

See above…

---

<div class="post-metadata">

**Author:** ![1634](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/1634/32/12119_2.png) [@1634](https://discourse.julialang.org/u/1634)\
**Post date:** [August 13, 2020, 2:28pm UTC](https://discourse.julialang.org/t/stackoverflowerror-with-boxplot-due-to-deprecation/44871/9 "2020-08-13T14:28:29Z")

</div>

Complementary information: after update all the packages (type `]update` in atom), this example also works perfectly in julia 1.4.
