diff --git a/src/axes.jl b/src/axes.jl index ead1d529..4e06b31b 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -731,10 +731,6 @@ function axis_drawing_info(sp, letter) f = RecipesPipeline.scale_func(oax[:scale]) invf = RecipesPipeline.inverse_scale_func(oax[:scale]) - w = width(sp.plotarea).value - h = height(sp.plotarea).value - tick_factor = (letter === :x ? w : h) / min(w, h) - add_major_or_minor_segments(ticks, grid, segments, factor, cond) = begin ticks === nothing && return if cond @@ -766,12 +762,14 @@ function axis_drawing_info(sp, letter) end end + ax_length = letter === :x ? height(sp.plotarea).value : width(sp.plotarea).value + # add major grid segments - add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 0.012 * tick_factor, ax[:tick_direction] !== :none) + add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 1.6 / ax_length, ax[:tick_direction] !== :none) # add minor grid segments if ax[:minorticks] ∉ (:none, nothing, false) || ax[:minorgrid] - add_major_or_minor_segments(minor_ticks, ax[:minorgrid], minorgrid_segments, 0.006 * tick_factor, true) + add_major_or_minor_segments(minor_ticks, ax[:minorgrid], minorgrid_segments, 1 / ax_length, true) end end end