Skip to content

Commit

Permalink
Merge pull request #1636 from oschulz/fixes-julia-v1.0
Browse files Browse the repository at this point in the history
More fixes for Julia v1.0
  • Loading branch information
mkborregaard authored Aug 11, 2018
2 parents b1095e2 + 1fda0df commit 5c21261
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,21 +498,25 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S
log_scale_x = xscale in _logScales
log_scale_y = yscale in _logScales

nbins = length(linearindices(weights))
if length(linearindices(edge)) != nbins + 1
nbins = length(eachindex(weights))
if length(eachindex(edge)) != nbins + 1
error("Edge vector must be 1 longer than weight vector")
end

x = eltype(edge)[]
y = eltype(weights)[]

it_e, it_w = start(edge), start(weights)
a, it_e = next(edge, it_e)
it_tuple_e = iterate(edge)
a, it_state_e = it_tuple_e
it_tuple_e = iterate(edge, it_state_e)

it_tuple_w = iterate(weights)

last_w = eltype(weights)(NaN)
i = 1
while (!done(edge, it_e) && !done(edge, it_e))
b, it_e = next(edge, it_e)
w, it_w = next(weights, it_w)

while it_tuple_e != nothing && it_tuple_w != nothing
b, it_state_e = it_tuple_e
w, it_state_w = it_tuple_w

if (log_scale_x && a 0)
a = b/_logScaleBases[xscale]^3
Expand All @@ -536,6 +540,9 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S

a = b
last_w = w

it_tuple_e = iterate(edge, it_state_e)
it_tuple_w = iterate(weights, it_state_w)
end
if (last_w != baseline)
push!(x, a)
Expand Down

0 comments on commit 5c21261

Please sign in to comment.