From a76cc58760adbf8b22919237c504759e75b947a1 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sun, 23 Apr 2023 19:01:50 +0200 Subject: [PATCH 1/2] Let some kwargs vary with k_ideal in WilkinsonTicks Specifically, `k_min = k_ideal - 4`, `k_max = k_ideal + 4`. Users can still override this as necessary. --- src/makielayout/ticklocators/wilkinson.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/makielayout/ticklocators/wilkinson.jl b/src/makielayout/ticklocators/wilkinson.jl index 2e5922db448..3af63725768 100644 --- a/src/makielayout/ticklocators/wilkinson.jl +++ b/src/makielayout/ticklocators/wilkinson.jl @@ -1,4 +1,4 @@ -function WilkinsonTicks(k_ideal::Int; k_min = 2, k_max = 10, +function WilkinsonTicks(k_ideal::Int = 6; k_min::Int = k_ideal - 4, k_max::Int = k_ideal + 4, Q = [(1.0,1.0), (5.0, 0.9), (2.0, 0.7), (2.5, 0.5), (3.0, 0.2)], granularity_weight = 1/4, simplicity_weight = 1/6, @@ -7,7 +7,7 @@ function WilkinsonTicks(k_ideal::Int; k_min = 2, k_max = 10, min_px_dist = 50.0) if !(0 < k_min <= k_ideal <= k_max) - error("Invalid tick number specifications k_ideal $k_ideal, k_min $k_min, k_max $k_max") + error("Invalid tick number specifications `k_ideal` $k_ideal, `k_min` $k_min, `k_max` $k_max. `k_ideal` must be between `k_min` and `k_max`!") end WilkinsonTicks(k_ideal, k_min, k_max, Q, granularity_weight, simplicity_weight, From d99896a0026f13b01a79d05a574e130eb9b7ffd0 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sun, 23 Apr 2023 19:32:05 +0200 Subject: [PATCH 2/2] Apply suggestion from review Co-authored-by: Julius Krumbiegel < julius.krumbiegel@gmail.com> --- src/makielayout/ticklocators/wilkinson.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/makielayout/ticklocators/wilkinson.jl b/src/makielayout/ticklocators/wilkinson.jl index 3af63725768..d48683bf5db 100644 --- a/src/makielayout/ticklocators/wilkinson.jl +++ b/src/makielayout/ticklocators/wilkinson.jl @@ -1,4 +1,4 @@ -function WilkinsonTicks(k_ideal::Int = 6; k_min::Int = k_ideal - 4, k_max::Int = k_ideal + 4, +function WilkinsonTicks(k_ideal::Int = 6; k_min::Int = max(2, round(Int, k_ideal * 0.7)), k_max::Int = max(2, round(Int, k_ideal * 1.3)), Q = [(1.0,1.0), (5.0, 0.9), (2.0, 0.7), (2.5, 0.5), (3.0, 0.2)], granularity_weight = 1/4, simplicity_weight = 1/6,