MCPcopy Index your code
hub / github.com/gonum/plot / median

Function median

plotter/boxplot.go:181–191  ·  view source on GitHub ↗

median returns the median value from a sorted Values.

(vs Values)

Source from the content-addressed store, hash-verified

179// median returns the median value from a
180// sorted Values.
181func median(vs Values) float64 {
182 if len(vs) == 1 {
183 return vs[0]
184 }
185 med := vs[len(vs)/2]
186 if len(vs)%2 == 0 {
187 med += vs[len(vs)/2-1]
188 med /= 2
189 }
190 return med
191}
192
193// Plot draws the BoxPlot on Canvas c and Plot plt.
194func (b *BoxPlot) Plot(c draw.Canvas, plt *plot.Plot) {

Callers 1

newFiveStatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected