趋势线
让我们回到 Height 与 Weight 的气泡图,按 Gender 着色,筛选 20 岁人群。现在要添加趋势线,并比较在考虑与不考虑调查权重时的趋势线差异。
本练习是课程的一部分
用 R 分析调查数据
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Add non-survey-weighted trend lines to bubble plot
ggplot(data = NHANES20, mapping = aes(x = Height, y = Weight, size = WTMEC4YR, color = Gender)) +
geom_point(alpha = 0.1) +
guides(size = "none") +
geom____(method = ___, se = FALSE, linetype = 2)