Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrete labels from break names #6148

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6147 and fix #6089.

Briefly, names(breaks) is used as default label for discrete breaks.
We also use this mechanism to populate discrete secondary labels (#6089).

Reprex from #6147 with a secondary axis:

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

ggplot(mpg, aes(drv, hwy)) +
  geom_boxplot() +
  scale_y_continuous(
    breaks = c(twenty = 20, thirty = 30, fourty = 40)
  ) +
  scale_x_discrete(
    breaks = c("four-wheel" = 4, forward = "f", reverse = "r"),
    sec.axis = dup_axis()
  )

Created on 2024-10-18 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant