Closed
Description
while trying to create a plot with the help of scale_y_discrete
's sec.axis
attribute, i am getting weird behavior.
library(ggplot2)
library(stringr)
data <- tibble(
question = c("A/B", "C/D", "E/F"),
value = c(.2, .5, .8)
)
data |>
ggplot(aes(x = value, y = question)) +
geom_point() +
scale_y_discrete(
labels = \(x) {str_split_i(x,"/",1)},
name = "A",
sec.axis = dup_axis(
labels = \(x) {str_split_i(x,"/",2)},
name = "B"
)
)
I've been trying to create plots for questions favorbility. and tried using the latest main using seeing that #5620 was merged.
The second axis labels
do not get the same value provided to scale_y_discrete
's labels
function.
what instead is passed to the second label is a vector of numbers.
Is this intended behavior?
Metadata
Metadata
Assignees
Labels
No labels