具有不同尺寸的R箱线图

盖茨1

我想对y轴上的计数和轴上的位置绘制箱形图,但是这些计数具有不同的计数量,如何绘制?谢谢!我还想获取计数的绝对值。谢谢!

> mat.count[1:50,]
    position               count
1  136873135                   0
2  136873136                   0
3  136873137                   0
4  136873138                   0
5  136873139                   0
6  136873140                 -15
7  136873141                   0
8  136873142                   0
9  136873143                   0
10 136873144                   0
11 136873145                   0
12 136873146                   0
13 136873147                   0
14 136873148                   0
15 136873149                   0
16 136873150                   0
17 136873151                   0
18 136873152                   0
19 136873153                   0
20 136873154                   0
21 136873155                   0
22 136873156                   0
23 136873157                   0
24 136873158                   0
25 136873159                   0
26 136873160                   0
27 136873161                   0
28 136873162                   0
29 136873163                   0
30 136873164                   0
31 136873165                   0
32 136873166                   0
33 136873167                   0
34 136873168                  -1
35 136873169                   0
36 136873170                   0
37 136873171                   0
38 136873172                   0
39 136873173                 -70
40 136873174                 -66
41 136873175 -73,-1,-1,-1,-73,-1
42 136873176                 -52
43 136873177                   0
44 136873178                   0
45 136873179              -66,-1
46 136873180                  -1
47 136873181                   0
48 136873182             -68,-75
49 136873183             -67,-67
50 136873184         -60,-56,-56
史蒂文·波普雷(StevenBeaupré)

尝试:

library(splitstackshape)
mc <- cSplit(mat.count, "count", sep =",", "long")
boxplot(abs(count) ~ position, data = mc, varwidth = TRUE)

在此处输入图片说明

或使用ggplot2

ggplot(mc, aes(x=as.factor(position), y=abs(count))) + 
  geom_boxplot(varwidth=TRUE) + 
  theme(text = element_text(size=6),
        axis.text.x = element_text(angle=90, vjust=1)) 

在此处输入图片说明

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

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

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章