From c02071a34008f082f0d97ab3b6540abb3734cbe3 Mon Sep 17 00:00:00 2001 From: Eddie Groshev Date: Thu, 3 Oct 2024 18:35:41 -0700 Subject: [PATCH] fix boxplot when range is zero --- src/stats/boxplot.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stats/boxplot.jl b/src/stats/boxplot.jl index d5b52e9259b..e761b96301e 100644 --- a/src/stats/boxplot.jl +++ b/src/stats/boxplot.jl @@ -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) @@ -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 @@ -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)