使用的是ggstream中的blockbusters数据集。
library(ggstream)
blockbusters
该包的geom_stream功能ggstrean允许 在 ggplot2 中创建流图。
library(ggstream)
# install.packages("ggplot2")
library(ggplot2)
ggplot(blockbusters, aes(x = year, y = box_office, fill = genre)) +
geom_stream()

该包包含一个名为的附加函数geom_stream_label,可用于将标签添加到流图的每个区域。
ggplot(blockbusters, aes(x = year, y = box_office, fill = genre)) +
geom_stream() +
geom_stream_label(aes(label = genre))
</
本文介绍了如何使用ggstream包在ggplot2中创建流图,特别是利用blockbusters数据集和geom_stream功能。此外,还提到了可以自定义填充颜色、边框颜色以及使用geom_stream_label添加区域标签,以及通过调整theme改变图表样式。
订阅专栏 解锁全文
375

被折叠的 条评论
为什么被折叠?



