Merge pull request #1174 from mkborregaard/fix_hist_weights
fix `weights` in `histogram`; closes #1173
This commit is contained in:
commit
dcc3055dec
@ -145,7 +145,7 @@ PlotExample("Bar",
|
|||||||
PlotExample("Histogram",
|
PlotExample("Histogram",
|
||||||
"",
|
"",
|
||||||
[:(begin
|
[:(begin
|
||||||
histogram(randn(1000), nbins=20)
|
histogram(randn(1000), bins = :scott, weights = repeat(1:5, outer = 200))
|
||||||
end)]
|
end)]
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -550,7 +550,7 @@ function _make_hist{N}(vs::NTuple{N,AbstractVector}, binning; normed = false, we
|
|||||||
edges = _hist_edges(vs, binning)
|
edges = _hist_edges(vs, binning)
|
||||||
h = float( weights == nothing ?
|
h = float( weights == nothing ?
|
||||||
StatsBase.fit(StatsBase.Histogram, vs, edges, closed = :left) :
|
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))
|
normalize!(h, mode = _hist_norm_mode(normed))
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user