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

GR: Draw all gridlines before axis (v2) #4960

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions PlotsBase/ext/GRExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1585,26 +1585,52 @@ 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)
# rmin, rmax = GR.adjustrange(ignorenan_minimum(r), ignorenan_maximum(r))
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 = 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 = 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 = 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 = PlotsBase.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)
Expand All @@ -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)
Expand Down
Loading