首页 > 解决方案 > 有没有办法在同一个图中绘制不同的回归模型?

问题描述

我在散点图中有一个数据集。我想“重叠”包含一些值而不是其他值的图表,但都在同一个数据集中。本质上,将相关性与 n=5、n=8 和 n=10 进行比较。有没有办法使用相同的数据为每一个设置我的回归线?

  geom_point(aes(fill = Vaccine), pch = 21, color = 'black', size = 4) +
  scale_fill_manual(values = color_list3) +
  geom_smooth(method='lm', se=F, color="black", size = 0.5) +
  stat_poly_eq(formula = y ~ x, 
               aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")), 
               parse = TRUE) +
  theme_classic() +
  theme(legend.title = element_text(face = "bold", hjust = 0.5),
        legend.background = element_blank(),
        legend.box.background = element_rect(colour = "black")) +
  coord_capped_cart(bottom = 'both', left = 'both') +
  labs(x = 'Log antibodies (GTM)', y = 'Vaccine efficacy') 

标签: rggplot2regression

解决方案


推荐阅读