Skip to content

Conversation

@teunbrand
Copy link
Collaborator

This PR aims to fix #6456.

It adds a new theme option that controls whether axes get displayed on top or below the panels.
The mechanism is changing the z value in the gtable.
By default, they are displayed on top of panels.

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

p <- ggplot() +
  annotate(
    "rect", xmin = 0, xmax = 1, ymin = 0, ymax = 1,
    colour = "dodgerblue", linewidth = 10, fill = NA
  ) +
  coord_cartesian(
    expand = FALSE,
    clip = "off"
  ) +
  theme(
    axis.line = element_line("tomato", linewidth = 1)
  )

p

Here they are displayed beneath panels.

p + theme(axis.ontop = FALSE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could the theme support axis lines and ticks being _not_ on top of geoms?

1 participant