tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.48k stars 2.02k forks source link

Restore axis line when `breaks = NULL`. #5838

Closed teunbrand closed 5 months ago

teunbrand commented 5 months ago

This PR aims to fix #5816.

Briefly, it restores the behaviour pre-3.5.0 that breaks = NULL would omit ticks and labels but include the axis line. In addition, that behaviour is now passed on to guide_axis_theta() and should be dealt with correctly when using guide_axis_stack().

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

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  coord_radial() +
  scale_x_continuous(breaks = NULL) +
  guides(
    theta = guide_axis_stack("axis_theta", "axis_theta", spacing = unit(5, "mm"))
  ) +
  theme(axis.line = element_line())

Created on 2024-04-12 with reprex v2.1.0