From 422988b3f6f005c178ed2530d6b4612ab9990b5c Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Fri, 13 Oct 2017 12:38:56 +0200 Subject: [PATCH 1/2] fix `weights` in `histogram` --- src/recipes.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipes.jl b/src/recipes.jl index 97352505..8fb582ae 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -550,7 +550,7 @@ function _make_hist{N}(vs::NTuple{N,AbstractVector}, binning; normed = false, we edges = _hist_edges(vs, binning) h = float( weights == nothing ? StatsBase.fit(StatsBase.Histogram, vs, edges, closed = :left) : - StatsBase.fit(StatsBase.Histogram, vs, weights, edges, closed = :left) + StatsBase.fit(StatsBase.Histogram, vs, StatsBase.Weights(weights), edges, closed = :left) ) normalize!(h, mode = _hist_norm_mode(normed)) end From 6db7116db9f4b8a56f00950a97add4590882d47f Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Fri, 13 Oct 2017 17:08:26 +0200 Subject: [PATCH 2/2] add `weights` argument to histogram example --- src/examples.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples.jl b/src/examples.jl index fabb368d..ed62e00e 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -145,7 +145,7 @@ PlotExample("Bar", PlotExample("Histogram", "", [:(begin - histogram(randn(1000), nbins=20) + histogram(randn(1000), bins = :scott, weights = repeat(1:5, outer = 200)) end)] ),