使用ggplot在`R`中的多个列的箱线图

我只是想在中创建一个数据框的三个数字列的箱线图R数据框如下所示:

  no_filter                      filter1                   filter2
1 0.7223437                    0.7376562                    0.7418750
2 0.7223437                    0.7376562                    0.7418750
3 0.7262500                    0.7276562                    0.7289062

我在这里看看如何使用多列和参数“ split”创建一个箱形图,但并没有真正了解它。因此,如果有人有想法,将不胜感激。在最好的情况下gpplot

阿克伦

使用ggplot,我们可能需要重塑为“长”格式

library(dplyr)
library(tidyr)
df1 %>% 
  pivot_longer(cols = everything()) %>% 
  ggplot(aes(x = name, y = value)) +
      geom_boxplot()

在此处输入图片说明

###数据

df1 <- structure(list(no_filter = c(0.7223437, 0.7223437, 0.72625), 
    filter1 = c(0.7376562, 0.7376562, 0.7276562), filter2 = c(0.741875, 
    0.741875, 0.7289062)), class = "data.frame", row.names = c("1", 
"2", "3"))

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章