From 471ac2bd9efd1d5d4ee944d4a2134c4a709e4821 Mon Sep 17 00:00:00 2001 From: Scott Kiesel Date: Wed, 13 Jul 2022 22:04:23 -0400 Subject: [PATCH] Fix off by one indexing bug in plotutil.MedianAndMinMax when determining the mean of the two inner-most elements in the slice. --- plotutil/errorpoints.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotutil/errorpoints.go b/plotutil/errorpoints.go index ccb12d5a0..0ac8b5525 100644 --- a/plotutil/errorpoints.go +++ b/plotutil/errorpoints.go @@ -103,7 +103,7 @@ func MedianAndMinMax(vls []float64) (med, lowerr, higherr float64) { } sort.Float64s(vls) if n%2 == 0 { - med = (vls[n/2+1]-vls[n/2])/2 + vls[n/2] + med = (vls[n/2]-vls[n/2-1])/2 + vls[n/2-1] } else { med = vls[n/2] }