在这样的图中,怎么可能把流量的标签从图中放下来呢
和美宝的黑色选项更胖,并把这些酒吧的标签,现在在中间的黑色列旁边
library(ggalluvial)
library(ggplot2)
library(dplyr)
df <- data.frame(status = c("open", "close", "close", "open/close", "close"),
stock = c("google", "amazon", "amazon", "yahoo", "amazon"),
newspaper = c("times", "newyork", "london", "times", "times"))
# Count the number of occurrences for each alluvial
df <- df %>% dplyr::group_by(stock, newspaper, status) %>%
summarise(n = n())
# Define the factors
df$status <- factor(df$status, levels = c("open", "open/close", "close"))
df$stock <- factor(df$stock, levels = c("google", "amazon", "yahoo"))
df$newspaper <- factor(df$newspaper, levels = c("times", "newyork", "london"))
# Plot the alluvial as in https://cran.r-project.org/web/packages/ggalluvial/vignettes/ggalluvial.html#alluvia-wide-format
ggplot2::ggplot(df.2, aes(y = n, axis1 = stock, axis2 = newspaper)) +
ggalluvial::geom_alluvium(aes(fill = status), width = 1/12) +
ggalluvial::geom_stratum(width = 1/12, fill = "black", color = "grey") +
ggplot2::geom_label(stat = "stratum", aes(label = after_stat(stratum))) +
ggplot2::scale_x_discrete(limits = c("stock", "newspaper"), expand = c(.05, .05)) +
ggplot2::scale_fill_brewer(type = "qual", palette = "Set1")
1条答案
按热度按时间0yg35tkg1#
对你想要的东西的描述相当模糊。据我所知,你希望图例移到情节的底部,地层条变得更宽: