Skip to content

Commit

Permalink
fix boxplot when range is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
EdsterG committed Oct 4, 2024
1 parent 8b4048a commit c02071a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/stats/boxplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function Makie.plot!(plot::BoxPlot)
end

# outliers
if Float64(range) != 0.0 # if the range is 0.0, the whiskers will extend to the data
if !iszero(range) # if the range is 0, the whiskers will extend to the data
limit = range * (q4 - q2)
inside = Float64[]
for (value, idx) in zip(values,idxs)
Expand All @@ -135,8 +135,6 @@ function Makie.plot!(plot::BoxPlot)
# change q1 and q5 to show outliers
# using maximum and minimum values inside the limits
q1, q5 = extrema_nan(inside)
# register boxcolor
push!(boxcolor, getuniquevalue(color, idxs))
end

# whiskers
Expand All @@ -147,6 +145,7 @@ function Makie.plot!(plot::BoxPlot)
push!(t_segments, (center, q4), (center, q5), (rw, q5), (lw, q5)) # upper T

# box
push!(boxcolor, getuniquevalue(color, idxs))
push!(centers, center)
push!(boxwidth, bw)
push!(boxmin, q2)
Expand Down

0 comments on commit c02071a

Please sign in to comment.