2017-09-21 1 views
1

これらのコマンドを使用して、各ボックスの同じ列に対応するポイントを持つボックスプロットをプロットしました。今のところ、私はちょうど順序なしでポイントをプロットすることができます。 boxplot Ant1の同じ列にrnorm1をプロットするにはどうすればよいですか?プロットがボックスプロットを指す

機能 'boxplot'は必須です。

rnorm1 = rnorm(100) 
rnorm2 = rnorm(100) 

boxplot(rnorm1, rnorm2, names=c("Ant1", "Ant2"), col=c("green", "red")) 
points(rnorm1, rnorm2) 

enter image description here

事前にありがとうございます。

+1

'ポイント(rbind(CBIND(tidyverse内dplyrggplot2を試しを1、rnorm1)、cbi nd(2、rnorm2))) ' –

答えて

2

私はbeeswarmパッケージをお勧めしたい:

library(beeswarm) 
df <- cbind.data.frame(rnorm1, rnorm2) 
boxplot(df) 
beeswarm(df, add=T) 

enter image description here

それとも

library(tidyverse) 
library(ggbeeswarm) 

cbind.data.frame(rnorm1, rnorm2) %>% 
    gather(key, value) %>% 
    ggplot(aes(key, value)) + 
    geom_boxplot() + 
    geom_beeswarm() + 
    theme_bw() 

enter image description here

関連する問題