Skip to content

Conversation

@teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Jul 8, 2024

This PR also aims to fix #5978 alongside #5981 and is mutually exclusive with #5982.

Briefly, it edits the default theme to have lineend = "square" for the children of axis.line.
The good thing is that it doesn't require any 'hacks' to get it to work:

library(ggplot2)

p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme_classic(base_line_size = 5) +
  theme(axis.ticks.length = unit(5, "mm"))
p

The bad thing is you can't easily swap the lineend, i.e. the following does not work:

p + theme(axis.line = element_line(lineend = "butt"))

Because you'd have to set the lineend in the child elements:

p + theme(
  axis.line.x = element_line(lineend = "butt"),
  axis.line.y = element_line(lineend = "butt")
)

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

@teunbrand
Copy link
Collaborator Author

Closing this pending further discussion

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

1 participant