How to create a grouped boxplot in R?

后端 未结 3 1477
离开以前
离开以前 2020-12-06 05:46

I want to merge the three datasets grouped and obtain a graph with only two boxes, 1 for A and 1 for B. Can you suggest how to get that?

I\'m tryng to create a group

3条回答
  •  有刺的猬
    2020-12-06 06:02

    You should use ggplot2

    ggplot() + 
      geom_boxplot(data = df, mapping = aes(col_name, value, fill=index))  + 
      theme( axis.text.x = element_blank()) +
      geom_segment(data=hline1, mapping=aes(x=1, y=-0.5, xend=3, yend=-0.5), size=2) +
      annotate("text", x = 2, y = -1, label = "A") + 
      geom_segment(data=hline1, mapping=aes(x=4, y=-0.5, xend=6, yend=-0.5), size=2) +
      annotate("text", x = 5, y = -1, label = "B")
    

提交回复
热议问题