Skip to content

Bug in guide training #5425

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

Closed
teunbrand opened this issue Sep 18, 2023 · 0 comments · Fixed by #5428
Closed

Bug in guide training #5425

teunbrand opened this issue Sep 18, 2023 · 0 comments · Fixed by #5428

Comments

@teunbrand
Copy link
Collaborator

In guide training this assumption is made:

ggplot2/R/guides-.R

Lines 416 to 417 in 25f54d9

# A strong assumption here is that `scales` is parallel to the guides
train = function(self, scales, direction, labels) {

I found out that you can violate this assumption as follows, where the first scale has 2 aesthetics and the second scale has 1 aesthetics.

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
packageVersion("ggplot2") # current main branch
#> [1] '3.4.3.9000'

df <- data.frame(x = (1:3)/3, z = c("red", "blue", "green"))

ggplot(df) +
  aes(x, z, colour = z, fill = z, size = x) +
  geom_point() +
  scale_discrete_identity(aesthetics = c("colour", "fill")) +
  scale_size_identity()
#> Warning in mapply(FUN = f, ..., SIMPLIFY = FALSE): longer argument not a
#> multiple of length of shorter

Created on 2023-09-18 with reprex v2.0.2

This is probably worth fixing and guaranteeing the assumption more.

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 a pull request may close this issue.

1 participant