You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a very niche and selfish problem as I'm trying some stuff out in {gguidance}.
It somewhat relates to #6076 a bit, but I'd like the following code:
library(ggplot2)
p<- ggplot(mpg, aes(displ, hwy)) +
geom_point() +
scale_x_continuous(
breaks=2:7,
labels=data.frame(foo=LETTERS[1:6], bar=1:6)
)
get_guide_data(p, aesthetic="x")
#> Error in `scale_x_continuous()`:#> ! `breaks` and `labels` have different lengths.
To return the following data.frame (note that the .label column is a nested data.frame rather than two separate .label.foo and .label.bar columns):
#> x .value .label.foo .label.bar y#> 1 0.1127946 2 A 1 0#> 2 0.2811448 3 B 2 0#> 3 0.4494949 4 C 3 0#> 4 0.6178451 5 D 4 0#> 5 0.7861953 6 E 5 0#> 6 0.9545455 7 F 6 0
The justification I have for this is that {vctrs} treats data.frames as vectors where rows are treated as elements. We don't really have a good reason to deviate from this behaviour.
The text was updated successfully, but these errors were encountered:
teunbrand
changed the title
Feature request: accept data.frame labels
Feature request: accept data.frame as labelsSep 7, 2024
teunbrand
changed the title
Feature request: accept data.frame as labels
Feature request: accept data.frame as scale labelsSep 7, 2024
This is a very niche and selfish problem as I'm trying some stuff out in {gguidance}.
It somewhat relates to #6076 a bit, but I'd like the following code:
Created on 2024-09-07 with reprex v2.1.1
To return the following data.frame (note that the
.label
column is a nested data.frame rather than two separate.label.foo
and.label.bar
columns):The justification I have for this is that {vctrs} treats data.frames as vectors where rows are treated as elements. We don't really have a good reason to deviate from this behaviour.
The text was updated successfully, but these errors were encountered: