From d073eefeb684b1de40a0c33e85cd4aa40392d204 Mon Sep 17 00:00:00 2001 From: Chris Binz Date: Sun, 23 Apr 2017 21:57:01 -0400 Subject: [PATCH 1/2] Adds a penalty for a tick span that is much larger than the data span --- src/ticks.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ticks.jl b/src/ticks.jl index 678149d..b4cba4d 100644 --- a/src/ticks.jl +++ b/src/ticks.jl @@ -114,7 +114,7 @@ function optimize_ticks_typed{T}(x_min::T, x_max::T, extend_ticks, g = 0 < k < 2k_ideal ? 1 - abs(k - k_ideal) / k_ideal : 0.0 # coverage - c = 1.5 * xspan/span + c = 1.5*xspan/span score = granularity_weight * g + simplicity_weight * s + @@ -124,6 +124,9 @@ function optimize_ticks_typed{T}(x_min::T, x_max::T, extend_ticks, # strict limits on coverage if strict_span && span > xspan score -= 10000 + if span >= 4.0*xspan + score -= 1000 + end elseif !strict_span && (span >= 2.0*xspan || span < xspan) score -= 1000 end From e88b3d5820e7cca801a283a358e4ae34aecc42d9 Mon Sep 17 00:00:00 2001 From: Chris Binz Date: Sun, 23 Apr 2017 21:59:32 -0400 Subject: [PATCH 2/2] Fix unrelated formatting changeg --- src/ticks.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ticks.jl b/src/ticks.jl index b4cba4d..164363d 100644 --- a/src/ticks.jl +++ b/src/ticks.jl @@ -114,7 +114,7 @@ function optimize_ticks_typed{T}(x_min::T, x_max::T, extend_ticks, g = 0 < k < 2k_ideal ? 1 - abs(k - k_ideal) / k_ideal : 0.0 # coverage - c = 1.5*xspan/span + c = 1.5 * xspan/span score = granularity_weight * g + simplicity_weight * s +