“In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.” Code-Antworten

In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.

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")
  )
MF

In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.

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)
MF

In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.

# 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")
MF

Ähnliche Antworten wie “In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.”

Fragen ähnlich wie “In IS_LODES_FORM (: fehlende ID-Achse-Paarungen.”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen