geom_flow() has yet to be implemented in plotly
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
I've added a reproducible example here. The plot will work under normal ggplot conditions but not if you send it to ggplotly
library(ggplot2)
library(ggalluvial)
library(tidyverse)
data(vaccinations)
levels(vaccinations$response) <- rev(levels(vaccinations$response))
vaccinations <- vaccinations %>%
group_by(survey) %>%
mutate(pct = freq / sum(freq)) %>%
ungroup() %>%
mutate(
test_color = case_when(
subject %in% {vaccinations %>%
filter(
survey == "ms460_NSA" & response %in% "Never"
) %>%
distinct(subject) %>%
pull()} ~ "Yes",
TRUE ~ "No"
)
)
g <- ggplot(vaccinations,
aes(x = survey, stratum = response, alluvium = subject,
y = pct,
fill = test_color,
label = response)) +
scale_x_discrete(expand = c(.1, .1)) +
scale_y_continuous(label = scales::percent_format()) +
scale_fill_manual(values = c("Yes" = "cadetblue1", "No" = "grey50")) +
geom_flow() +
geom_stratum(alpha = .5) +
geom_text(aes(label = paste0(..stratum.., "\n", scales::percent(..count.., accuracy = .1))), stat = "stratum", size = 3) +
theme(legend.position = "none") +
ggtitle("vaccination survey responses at three points in time")
g
g %>% ggplotly()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided vaccinations example in R and tracing the ggplotly() conversion path for geom_flow(). Compare the rendered result with the original ggplot output. Done means geom_flow() is supported by ggplotly() and the example renders the expected flows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100