You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suppose for consistency with the existing theme grammar, these axis arguments should apply to the axis text too.
Thanks for your consideration, and the great ggplot2 dev work!
library(dplyr)
#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, union
library(ggplot2)
library(palmerpenguins)
#> #> Attaching package: 'palmerpenguins'#> The following objects are masked from 'package:datasets':#> #> penguins, penguins_rawd<-penguins|>
add_row(
flipper_length_mm=190,
body_mass_g=2500,
species="Adelie",
) |>
add_row(
flipper_length_mm=165,
body_mass_g=3000,
species="Adelie",
)
p<-d|>
ggplot() +
geom_point(aes(x=flipper_length_mm, y=body_mass_g),
colour="steelblue", size=3) +
theme_classic() +
scale_x_continuous(expand= c(0, 0)) +
scale_y_continuous(expand= c(0, 0)) +
coord_cartesian(clip="off")
p#> Warning: Removed 2 rows containing missing values or values outside the scale range#> (`geom_point()`).
#so something like this to make the axis line/ticks not ontop# p +# theme(axis.ontop = FALSE) ## p +# theme(axis.ontop.x = FALSE) +# theme(axis.ontop.y = FALSE)
The text was updated successfully, but these errors were encountered:
davidhodge931
changed the title
Feature request: Could the theme support axis lines and ticks being _not_ on top of geoms?
Could the theme support axis lines and ticks being _not_ on top of geoms?
May 21, 2025
Uh oh!
There was an error while loading. Please reload this page.
There are situations where it would nice to be able to easily make the the axis line/ticks not be on top of geoms.
I noticed the theme argument has a panel.ontop argument. So I wondered if you guys would consider adding equivalent theme arguments for the axis.
Something like
theme(axis.ontop = TRUE, axis.ontop.x = TRUE, axis.ontop.y = TRUE)
.I suppose for consistency with the existing theme grammar, these axis arguments should apply to the axis text too.
Thanks for your consideration, and the great ggplot2 dev work!
Created on 2025-05-14 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: