Skip to content

Conversation

@teunbrand
Copy link
Collaborator

This PR aims to fix #5978.

It does so by editing the contents of theme_classic(), namely black ticks and axis text and using a square line end for the axis line.
Notably, it does not solve the issue that the 'default' axis line lineend should be square.

Example of theme change, exaggerated linewidth and text size for easier inspection:

library(ggplot2)

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme_classic(base_line_size = 5) +
  theme(
    axis.ticks.length = unit(5, "mm"),
    axis.text = element_text(size = rel(2))
  )

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

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme_classic(base_line_size = 5) +
  theme(
    axis.ticks.length = unit(5, "mm"),
    axis.text = element_text(size = rel(2))
  )

Created on 2024-07-08 with reprex v2.1.0

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand teunbrand merged commit 8ca3bbc into tidyverse:main Aug 26, 2024
@teunbrand teunbrand deleted the opt1_theme_classic_update branch August 26, 2024 13:18
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.

Suggestion to change the default line end of axis lines in theme_classic

2 participants