title: Lineair regression plot of 1 measured variable in 4 groups with 1 group being the reference group
body: <p>So I have 1 measured variabel multiple times in 4 groups of which 1 group is the refernce group where I want to make a regression plot to with the other 3 groups. How do generate that? I see lots of examples of 2 variables plotted in groups but not what I mean (like: <a href="https://community.rstudio.com/t/multiple-linear-regression-lines-in-a-graph-with-ggplot2/9328" rel="nofollow noreferrer">https://community.rstudio.com/t/multiple-linear-regression-lines-in-a-graph-with-ggplot2/9328</a>)</p>
  <p>This my df:</p>
  <pre><code>df &lt;- data.frame(&quot;Variabel&quot; = c(1,2,3,5,6,6,3,5,8,7,4,1,3,6,8,5),
               &quot;group&quot; = c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4))
  </code></pre>
  <p>And her my lin regression code</p>
  <pre><code> #display regression formula in plot
    my.formula &lt;-  y ~ x 
  
    LM_plot &lt;- ggplot(df, aes(x=...,y=...., shape=group, colour=group, fill=group))+
    geom_point(shape=21,size=4,colour = &quot;black&quot; ,alpha=0.5)+
    geom_smooth(method=&quot;lm&quot;,alpha=0.3,color=&quot;blue&quot;,fill=&quot;grey&quot;, formula = my.formula)+
    geom_abline(intercept=0,slope=1,size=0.5,linetype=&quot;dashed&quot;,color=&quot;black&quot;)+
    theme_bw(base_rect_size = 0.2) +
    labs(x = &quot;Group 1&quot;, y = &quot;Group 2, 3 and 4&quot;) +
    ggtitle(&quot;Title&quot;) +
    stat_poly_eq(aes(label = paste0(&quot;atop(&quot;, ..eq.label.., &quot;,&quot;, ..rr.label.., &quot;)&quot;)), 
                 formula = my.formula, 
                 parse = TRUE)
  </code></pre>