Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let some kwargs vary with k_ideal in WilkinsonTicks #2892

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions src/makielayout/ticklocators/wilkinson.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function WilkinsonTicks(k_ideal::Int; k_min = 2, k_max = 10,
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,
Expand All @@ -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,
Expand Down
Loading