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 have the same issue with the question here. I will copy and paste it here.
I want to use the ggline of the package ggpubr with 2 aesthetics. The quivalent perfectly works in geom_line but not in ggline. Let's say I have this dataset
data <- data.frame(x = seq(0,1,length.out = 100)) %>% mutate(a = x^2, b = x^3, c = (x+1)^-1, d = (x + 1)^-2) %>% pivot_longer(cols = c(a,b,c,d), names_to = 'var',values_to = 'val') %>% mutate(type = ifelse(var %in% c('a','b'), 'poly','inv'), order = ifelse(var %in% c('a','c'), 'low','high'))
Now I can use geom_line to get the plot of all.
data %>% ggplot() + geom_line(aes(x = x, y = val, linetype = type, color = order)
But using the same thing ggline
data %>% ggline(x = "x", y = "val", linetype = "type", color = "order")
produces the error
Error in purrr::pmap(): ℹ In index: 1. ℹ With name: val. Caused by error in purrr::map(): ℹ In index: 3. ℹ With name: group. Caused by error in if (is_parsable_aes(x)) ...: ! the condition has length > 1 Run rlang::last_trace() to see where the error occurred.
The text was updated successfully, but these errors were encountered:
I have the same issue with the question here. I will copy and paste it here.
I want to use the ggline of the package ggpubr with 2 aesthetics. The quivalent perfectly works in geom_line but not in ggline. Let's say I have this dataset
data <- data.frame(x = seq(0,1,length.out = 100)) %>% mutate(a = x^2, b = x^3, c = (x+1)^-1, d = (x + 1)^-2) %>% pivot_longer(cols = c(a,b,c,d), names_to = 'var',values_to = 'val') %>% mutate(type = ifelse(var %in% c('a','b'), 'poly','inv'), order = ifelse(var %in% c('a','c'), 'low','high'))
Now I can use geom_line to get the plot of all.
data %>% ggplot() + geom_line(aes(x = x, y = val, linetype = type, color = order)
But using the same thing ggline
data %>% ggline(x = "x", y = "val", linetype = "type", color = "order")
produces the error
Error in
purrr::pmap(): ℹ In index: 1. ℹ With name: val. Caused by error in
purrr::map(): ℹ In index: 3. ℹ With name: group. Caused by error in
if (is_parsable_aes(x)) ...: ! the condition has length > 1 Run
rlang::last_trace()to see where the error occurred.
The text was updated successfully, but these errors were encountered: