2017-03-07 69 views
0

我想擺脫包含boxplot和beeswarm的圖中的異常值。beeswarm情節和boxplot異常值

我創建具有以下行的箱線圖:

boxplot(Lead_s ~ Group, data = g, outline = FALSE, 
    main = 'Gaze shift duration with co-occuring movement units', 
    horizontal=TRUE,xlab = "Gaze lead (sec)") 

隨着outline=FALSE我的異常消失。

然後,我運行這段代碼來獲取蜂羣形式的數據點。

beeswarm(Lead_s ~ Group, data = g, col = 4, pch = 16, 
    add = TRUE,horizontal=TRUE,pwcol = 1 + as.numeric(Lead_s)) 

與蜂羣箱線圖:

My graph

會發生什麼事是,outliers是圖的繪製之外。無論我是否添加outline=FALSE,離羣值仍然存在。

這是我繪製的數據樣本:

Group   Lead_s 
Non-Performers 1 
Non-Performers 3 
Expert 18 
Non-Performers 0.1 
Non-Performers 0.1 
Non-Performers 0.1 
Non-Performers 0.2 
Non-Performers 0.2 
Non-Performers 0.3 
Expert 0.4 
Non-Performers 0.4 
Non-Performers 0.4 
Expert 0.5 
Non-Performers 0.5 
Non-Performers 0.6 
Non-Performers 0.6 
Non-Performers 0.7 
Expert 0.8 
Non-Performers 0.8 
Expert 1.1 
Expert 1.1 
Non-Performers 1.1 
Expert 1.3 
Non-Performers 1.3 
Non-Performers 1.4 
Non-Performers 1.4 
Non-Performers 1.4 
Non-Performers 1.5 
Expert 1.7 
Expert 1.9 
Non-Performers 1.9 
Expert 2.1 
Non-Performers 2.1 
Non-Performers 2.1 
Non-Performers 2.1 
Non-Performers 2.3 
Expert 2.5 
Expert 2.7 
Expert 2.7 
Non-Performers 3.1 
Expert 4.1 
Expert 4.5 
Non-Performers 5.6 
Non-Performers 6.7 

任何想法如何解決呢?

+0

尋求幫助時,你應該總是發表[重複的例子, ](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)與樣本輸入數據,所以我們可以運行和測試代碼。 – MrFlick

+0

@MrFlick:添加的數據 – user3832272

+0

我無法在新的R會話中重現此操作。你確定在調用這些函數之前沒有對'par()'做任何修改嗎? – MrFlick

回答

0

您似乎有一個非默認的'xpd'(剪輯)設置。 (見?par

若要獲取默認的行爲(不顯示繪圖區域以外的任何點)的前後情節的命令,你可以設置XPD:

par(xpd = FALSE)