From 5f31ab716946ba3294d3a2b0adfe0fd492a153af Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Wed, 21 Jul 2021 22:30:56 +0200 Subject: [PATCH] fix gr tickmarks lengths for 2D plots --- src/axes.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/axes.jl b/src/axes.jl index 57b13830..840d90fc 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -731,6 +731,10 @@ 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 @@ -763,11 +767,11 @@ function axis_drawing_info(sp, letter) end # add major grid segments - add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 0.012, ax[:tick_direction] !== :none) + add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 0.012 * tick_factor, 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, true) + add_major_or_minor_segments(minor_ticks, ax[:minorgrid], minorgrid_segments, 0.06 * tick_factor, true) end end end