热图的替代方案
热图有多种替代方案。最佳选择取决于您的数据以及您想通过数据讲述的故事。如果包含时间维度,最直接的选择通常是折线图。
本练习是课程的一部分
ggplot2 数据可视化进阶
交互式实操练习
通过完成这段示例代码来试试这个练习。
# The heat map we want to replace
# Don't remove, it's here to help you!
ggplot(barley, aes(x = year, y = variety, fill = yield)) +
geom_tile() +
facet_wrap( ~ site, ncol = 1) +
scale_fill_gradientn(colors = brewer.pal(9, "Reds"))
# Using barley, plot yield vs. year, colored and grouped by variety
___ +
# Add a line layer
___ +
# Facet, wrapping by site, with 1 row
facet_wrap( ~ site, nrow = 1)