In is_lodes_form( : Missing id-axis pairings.
# Assume 'g' is the previous plot object saved under a variable
newdat <- layer_data(g)
newdat <- newdat[newdat$side == "start", ]
split <- split(newdat, interaction(newdat$stratum, newdat$x))
split <- lapply(split, function(dat) {
dat$label <- dat$label / sum(dat$label)
dat
})
newdat <- do.call(rbind, split)
ggplot(vaccinations,
aes(x = survey, stratum = response, alluvium = subject,
y = freq,
fill = response, label = freq)) +
scale_x_discrete(expand = c(.1, .1)) +
geom_flow() +
geom_stratum(alpha = .5) +
geom_text(stat = "stratum", size = 3) +
geom_text(data = newdat, aes(x = xmin + 0.4, y = y, label = format(label, digits = 1)),
inherit.aes = FALSE) +
theme(legend.position = "bottom") +
ggtitle("vaccination survey responses at three points in time")
4
7
A_col <- "firebrick3"
B_col <- "darkorange"
C_col <- "deepskyblue3"
alpha <- 0.7
ggplot(fb_ad_3d,
aes(weight = freq, axis1 = Category, axis2 = Response)) +
geom_alluvium(aes(fill = Response, color = Response),
width = 1/12, alpha = alpha, knot.pos = 0.4) +
geom_stratum(width = 1/6, color = "grey") +
geom_label(stat = "stratum", label.strata = TRUE) +
scale_x_continuous(breaks = 1:2, labels = c("Category", "Response")) +
scale_fill_manual(values = c(A_col, B_col, C_col)) +
scale_color_manual(values = c(A_col, B_col, C_col)) +
ggtitle("Relevance of Facebook Custom List Advertising") +
theme_minimal() +
theme(
axis.text.x = element_text(size = 12, face = "bold")
)
Thank you!
7
0
4.3
10
library(dplyr) # to manipulate data
library(alluvial)
allu <- data %>%
group_by(Diagnose1, Diagnose2, Diagnose3) %>% # grouping
summarise(Freq = n()) # adding frequencies
# here the plot
alluvial(allu[,1:3], freq=allu$Freq)
Thank you!
10
0
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line