I am trying to create a plot which contains 3 boxplots.
First one has 21 data point, second one has 26 and third one has 21 data points.
I can create each one seperately using StatsPlots library. When I try to combine them I am getting error.
Here is the data and output I got:
using StatsPlots
a = rand(21)*600
b = rand(26)*600
c = rand(21)*600
bp1 = boxplot(["Tier 1"],a,leg=false;notch=true,ylim=(0,600))
bp2 = boxplot(["Tier 2"],b,leg=false;notch=true,ylim=(0,600))
bp3 = boxplot(["Tier 3"],c,leg=false;notch=true,ylim=(0,600))
StatsPlots.plot(bp1, bp2, bp3)
When I run:
boxplot(["Tier 1"],a,leg=false;notch=true,ylim=(0,600))
boxplot!(["Tier 2"],b,leg=false;notch=true,ylim=(0,600))
boxplot!(["Tier 3"],c,leg=false;notch=true,ylim=(0,600))
I am getting this error:
BoundsError: attempt to access 1-element Array{Float64,1} at index [2]
Stacktrace:
[1] getindex(::Array{Float64,1}, ::Int64) at ./array.jl:731
[2] macro expansion at /home/ec2-user/.julia/packages/StatsPlots/HQ166/src/boxplot.jl:51 [inlined]
[3] apply_recipe(::Dict{Symbol,Any}, ::Type{Val{:boxplot}}, ::Array{String,1}, ::Array{Float64,1}, ::Nothing) at /home/ec2-user/.julia/packages/RecipesBase/Uz5AO/src/RecipesBase.jl:275
[4] _process_seriesrecipe(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}) at /home/ec2-user/.julia/packages/Plots/qh1wV/src/pipeline.jl:408
[5] macro expansion at ./logging.jl:318 [inlined]
[6] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{String,1},Array{Float64,1}}) at /home/ec2-user/.julia/packages/Plots/qh1wV/src/plot.jl:171
[7] plot!#137(::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:leg, :notch, :ylim, :seriestype),Tuple{Bool,Bool,Tuple{Int64,Int64},Symbol}}}, ::Function, ::Plots.Plot{Plots.GRBackend}, ::Array{String,1}, ::Vararg{Any,N} where N) at /home/ec2-user/.julia/packages/Plots/qh1wV/src/plot.jl:158
[8] (::getfield(RecipesBase, Symbol(“#kw#plot!”)))(::NamedTuple{(:leg, :notch, :ylim, :seriestype),Tuple{Bool,Bool,Tuple{Int64,Int64},Symbol}}, ::typeof(plot!), ::Plots.Plot{Plots.GRBackend}, ::Array{String,1}, ::Vararg{Any,N} where N) at ./none:0
[9] plot!#136(::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:leg, :notch, :ylim, :seriestype),Tuple{Bool,Bool,Tuple{Int64,Int64},Symbol}}}, ::Function, ::Array{String,1}, ::Vararg{Any,N} where N) at /home/ec2-user/.julia/packages/Plots/qh1wV/src/plot.jl:150
[10] (::getfield(RecipesBase, Symbol(“#kw#plot!”)))(::NamedTuple{(:leg, :notch, :ylim, :seriestype),Tuple{Bool,Bool,Tuple{Int64,Int64},Symbol}}, ::typeof(plot!), ::Array{String,1}, ::Array{Float64,1}) at ./none:0
[11] #boxplot!#404(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:leg, :notch, :ylim),Tuple{Bool,Bool,Tuple{Int64,Int64}}}}, ::Function, ::Array{String,1}, ::Vararg{Any,N} where N) at /home/ec2-user/.julia/packages/RecipesBase/Uz5AO/src/RecipesBase.jl:369
[12] (::getfield(Plots, Symbol(“#kw##boxplot!”)))(::NamedTuple{(:leg, :notch, :ylim),Tuple{Bool,Bool,Tuple{Int64,Int64}}}, ::typeof(boxplot!), ::Array{String,1}, ::Vararg{Any,N} where N) at ./none:0
[13] top-level scope at In[10]:2