From 3c6991bd55f7bfe08be0ab889cac471361ac3f2d Mon Sep 17 00:00:00 2001 From: dd0 Date: Tue, 18 Jun 2024 17:52:09 +0100 Subject: [PATCH 1/2] GR: Draw all gridlines before axis Separates grid drawing from the remainder of gr_draw_axis, so that all gridlines are drawn below the axis. Previously, y-axis gridlines were drawn after the x-axis and could overlap it. Fixes issue #4202 for GR. --- PlotsBase/ext/GRExt.jl | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/PlotsBase/ext/GRExt.jl b/PlotsBase/ext/GRExt.jl index a1dfabfa5..5d584e398 100644 --- a/PlotsBase/ext/GRExt.jl +++ b/PlotsBase/ext/GRExt.jl @@ -1585,6 +1585,8 @@ function gr_draw_axes(sp, vp) x_bg, y_bg = RecipesPipeline.unzip(GR.wc3towc.(area_x, area_y, area_z)) GR.fillarea(x_bg, y_bg) + foreach(letter -> gr_draw_axis_minorgrid_3d(sp, letter, vp), (:x, :y, :z)) + foreach(letter -> gr_draw_axis_grid_3d(sp, letter, vp), (:x, :y, :z)) foreach(letter -> gr_draw_axis_3d(sp, letter, vp), (:x, :y, :z)) elseif ispolar(sp) r = gr_set_viewport_polar(vp) @@ -1592,19 +1594,43 @@ function gr_draw_axes(sp, vp) rmin, rmax = axis_limits(sp, :y) gr_polaraxes(rmin, rmax, sp) elseif sp[:framestyle] ≢ :none + foreach(letter -> gr_draw_axis_minorgrid(sp, letter, vp), (:x, :y)) + foreach(letter -> gr_draw_axis_grid(sp, letter, vp), (:x, :y)) foreach(letter -> gr_draw_axis(sp, letter, vp), (:x, :y)) end GR.settransparency(1.0) nothing end +function gr_draw_axis_minorgrid_3d(sp, letter, vp) + ax = axis_drawing_info_3d(sp, letter) + axis = sp[get_attr_symbol(letter, :axis)] + gr_draw_minorgrid(sp, axis, ax.minorgrid_segments, gr_polyline3d) +end + +function gr_draw_axis_grid_3d(sp, letter, vp) + ax = axis_drawing_info_3d(sp, letter) + axis = sp[get_attr_symbol(letter, :axis)] + gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d) +end + +function gr_draw_axis_minorgrid(sp, letter, vp) + ax = axis_drawing_info(sp, letter) + axis = sp[get_attr_symbol(letter, :axis)] + gr_draw_minorgrid(sp, axis, ax.minorgrid_segments) +end + +function gr_draw_axis_grid(sp, letter, vp) + ax = axis_drawing_info(sp, letter) + axis = sp[get_attr_symbol(letter, :axis)] + gr_draw_grid(sp, axis, ax.grid_segments) +end + function gr_draw_axis(sp, letter, vp) ax = PlotsBase.axis_drawing_info(sp, letter) axis = sp[get_attr_symbol(letter, :axis)] # draw segments - gr_draw_grid(sp, axis, ax.grid_segments) - gr_draw_minorgrid(sp, axis, ax.minorgrid_segments) gr_draw_spine(sp, axis, ax.segments) gr_draw_border(sp, axis, ax.border_segments) gr_draw_ticks(sp, axis, ax.tick_segments) @@ -1620,8 +1646,6 @@ function gr_draw_axis_3d(sp, letter, vp) axis = sp[get_attr_symbol(letter, :axis)] # draw segments - gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d) - gr_draw_minorgrid(sp, axis, ax.minorgrid_segments, gr_polyline3d) gr_draw_spine(sp, axis, ax.segments, gr_polyline3d) gr_draw_border(sp, axis, ax.border_segments, gr_polyline3d) gr_draw_ticks(sp, axis, ax.tick_segments, gr_polyline3d) From 89595ff8f7ee0cdb1a3e1a1c8051b9a58aa57a06 Mon Sep 17 00:00:00 2001 From: dd0 Date: Sat, 13 Jul 2024 00:32:24 +0100 Subject: [PATCH 2/2] Added qualified PlotsBase names missing from v1 port --- PlotsBase/ext/GRExt.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PlotsBase/ext/GRExt.jl b/PlotsBase/ext/GRExt.jl index 5d584e398..2e4490803 100644 --- a/PlotsBase/ext/GRExt.jl +++ b/PlotsBase/ext/GRExt.jl @@ -1603,25 +1603,25 @@ function gr_draw_axes(sp, vp) end function gr_draw_axis_minorgrid_3d(sp, letter, vp) - ax = axis_drawing_info_3d(sp, letter) + ax = PlotsBase.axis_drawing_info_3d(sp, letter) axis = sp[get_attr_symbol(letter, :axis)] gr_draw_minorgrid(sp, axis, ax.minorgrid_segments, gr_polyline3d) end function gr_draw_axis_grid_3d(sp, letter, vp) - ax = axis_drawing_info_3d(sp, letter) + ax = PlotsBase.axis_drawing_info_3d(sp, letter) axis = sp[get_attr_symbol(letter, :axis)] gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d) end function gr_draw_axis_minorgrid(sp, letter, vp) - ax = axis_drawing_info(sp, letter) + ax = PlotsBase.axis_drawing_info(sp, letter) axis = sp[get_attr_symbol(letter, :axis)] gr_draw_minorgrid(sp, axis, ax.minorgrid_segments) end function gr_draw_axis_grid(sp, letter, vp) - ax = axis_drawing_info(sp, letter) + ax = PlotsBase.axis_drawing_info(sp, letter) axis = sp[get_attr_symbol(letter, :axis)] gr_draw_grid(sp, axis, ax.grid_segments) end