areaplot包绘制堆叠面积图
library(areaplot)
#数据
df <- longley
x <- df$Year
y <- df[, c(1, 2, 3, 4, 6, 8)]
# 颜色
cols <- hcl.colors(6, palette = "viridis", alpha = 0.8)
#绘图
areaplot(x, y, prop = TRUE, col = cols,
border = "white",
lwd = 1,
lty = 1)
#添加图例标签
areaplot(x, y, prop = TRUE, col = cols,
legend = TRUE,
args.legend = list(x = "topleft", cex = 0.65,