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
I can use expressions in scale_x_discrete() normally by setting labels = expression(...), but when use guide = axis_nested, using labels doesn't work anymore, because multiple labels are needed and I think the labels are taken directly from interaction() or weave_factors(). How can we use expressions with nested axis labels? Or is there a way to pass multiple custom label elements with expressions to weave_factors?
Expressions in labels Example:
# Single category, not nested data
data <- data.frame(
Category = factor(c("A", "B", "C", "D")),
Value = c(10, 20, 15, 25)
)
ggplot(data, aes(x = Category, y = Value)) +
geom_col() +
scale_x_discrete(labels = expression(
Category~alpha,
Category~beta,
Category~delta,
Category~gamma)
)
The text was updated successfully, but these errors were encountered:
Yeah that's right, the text itself is used to parse out the different hierarchy levels, which doesn't work with expressions.
I'm not planning to do any updates to guide_axis_nested(), as I'm working on something similar using functionality that now only lives in dev-ggplot2. Until that arrives, I'm afraid this isn't possible.
I can use expressions in scale_x_discrete() normally by setting labels = expression(...), but when use guide = axis_nested, using labels doesn't work anymore, because multiple labels are needed and I think the labels are taken directly from interaction() or weave_factors(). How can we use expressions with nested axis labels? Or is there a way to pass multiple custom label elements with expressions to weave_factors?
Expressions in labels Example:
The text was updated successfully, but these errors were encountered: