ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Add missing theme sub args

Open teunbrand opened this issue 10 months ago • 0 comments

This PR aims to fix #6491.

It integrates the panel.widths, panel.heights, axis.minor.ticks.length.{...} and axis.minor.ticks.{...} settings in the theme_sub_axis_*() family and theme_sub_panel() function.

A demo:

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

minor <- guide_axis(minor.ticks = TRUE)

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  # Panel settings
  theme_sub_panel(
    widths = unit(5, "cm"),
    heights = unit(5, "cm")
  ) +
  # Minor ticks settings
  guides(x = minor, y = minor, x.sec = minor, y.sec = minor) +
  theme_sub_axis(minor.ticks.length = unit(5, "mm")) +
  theme_sub_axis_bottom(minor.ticks = element_line(colour = "red")) +
  theme_sub_axis_left(minor.ticks = element_line(colour = "limegreen")) +
  theme_sub_axis_right(minor.ticks = element_blank()) +
  theme_sub_axis_top(minor.ticks.length = unit(1, "mm"))

Created on 2025-06-02 with reprex v2.1.1

teunbrand avatar Jun 02 '25 14:06 teunbrand