23.18 不同喂食方式对小鸡体重的影响 II

ggplot(data = ChickWeight, aes(x = Time, y = weight, group = Chick, color = Diet)) +
  geom_point() +
  geom_line() +
  facet_wrap(~Diet) +
  theme_minimal()

添加趋势线

ggplot(data = ChickWeight, 
       aes(x = Time, y = weight, group = Diet, colour = Diet)) +
  facet_wrap(~Diet) +
  geom_jitter() +
  stat_summary(fun = "mean", geom = "line", colour = "black") +
  theme_minimal() +
  labs(
    title = "Chick Weight over Time by Diet",
    x = "Time (days)",
    y = "Weight (grams)"
  )