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

Merged
merged 10 commits into from
Nov 11, 2024

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

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 and others added 3 commits October 30, 2024 15:24
Merge branch 'main' into discrete_labels_from_break_names

# Conflicts:
#	R/scale-.R
@teunbrand teunbrand merged commit 094b957 into tidyverse:main Nov 11, 2024
13 checks passed
@teunbrand teunbrand deleted the discrete_labels_from_break_names branch November 11, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants