From db1e25252ad1a59a3d49f3e276b2f3e88a30c701 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Sun, 30 Jun 2019 17:38:53 +0200 Subject: [PATCH 1/2] Fix zero and NaN weighted bins in stephist for log-yscale Bins with weight NaN and zero (which the Plots engine seems to turn into into NaN automatically for log-yscale) should not be draws in log-yscale. --- src/recipes.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/recipes.jl b/src/recipes.jl index 705ac54b..cc12b522 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -545,6 +545,8 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S if !isnan(last_w) push!(x, a) push!(y, baseline) + push!(x, NaN) + push!(y, NaN) end else if isnan(last_w) From 7214b8b1b1bd6844d1240098d1926e90ee507435 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Sun, 30 Jun 2019 17:41:49 +0200 Subject: [PATCH 2/2] Improve type stability of _stepbins_path --- src/recipes.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/recipes.jl b/src/recipes.jl index cc12b522..daa88a89 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -538,7 +538,7 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S w, it_state_w = it_tuple_w if (log_scale_x && a ≈ 0) - a = b/_logScaleBases[xscale]^3 + a = oftype(a, b/_logScaleBases[xscale]^3) end if isnan(w) @@ -559,8 +559,8 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S push!(y, w) end - a = b - last_w = w + a = oftype(a, b) + last_w = oftype(last_w, w) it_tuple_e = iterate(edge, it_state_e) it_tuple_w = iterate(weights, it_state_w)