2013-05-07 97 views
1

我已經用包multcompview能夠基於ANOVA和HSD的Tukey檢驗可視地顯示組間顯著差異:添加軸標籤到multcompview constrast地塊

Group=c("G1","G1","G1","G1","G2","G2","G2","G2","G3","G3","G3","G3") 
set.seed(0) 
Vals=c(runif(4),runif(4)+0.7,runif(4)-0.7) 
data=data.frame(Group) 
data=cbind(data, Vals) 
library(multcompView) 
xzx <-multcompBoxplot(Vals~Group,data=data,sortFn=median, decreasing=FALSE,  
        horizontal=FALSE, 
        plotList=list(
        boxplot=list(fig=c(0, 1, 0, 1), las=3, 
           cex.axis=1.5),      
        multcompLetters=list(
         fig=c(0.87, 0.97, 0.115, 0.923), #0.1108, 0.9432 Top of  
         #page 18 manual for very convoluted explanation (c(y bottom, y top,x L, x R)) 
         type='Letters'))) 

enter image description here

下面是一個我的一個實際圖的例子: enter image description here 該方法(在SO中發佈相關問題後發現)工作得很好,但我還沒找到能夠添加ay軸標籤的方法(我需要標記Y變量「排名漏洞」)。 multcomp函數似乎沒有采用ylab參數。 如果沒有基本的軸標信息,這些總體好看的對比度圖表是令人沮喪的... 您是否知道這個問題的解決方案/解決方法?

回答

1

我也試過這個不錯的,但不是自我解釋的軟件包。 我發現,當你想標記軸或主標題時,你必須在multcompBoxplot()之後啓動title()。 例如:

title(ylab = 'Response', main = 'Title') 
0

沒有得到響應的其他任何人在SO和尋找周圍的複雜程度不同的各種解決方案之後,我發現一個運作良好,是非常簡單的(使用MTEXT):

Group=c("G1","G1","G1","G1","G2","G2","G2","G2","G3","G3","G3","G3") 
set.seed(0) 
Vals=c(runif(4),runif(4)+0.7,runif(4)-0.7) 
data=data.frame(Group) 
data=cbind(data, Vals) 
library(multcompView) 
xzx <-multcompBoxplot(Vals~Group,data=data,sortFn=median, decreasing=FALSE,  
         horizontal=FALSE, 
         plotList=list(
         boxplot=list(fig=c(0, 1, 0, 1), las=3, 
            cex.axis=1.5),      
         multcompLetters=list(
          fig=c(0.87, 0.97, 0.115, 0.923), #0.1108, 0.9432 Top of  
          #page 18 manual for very convoluted explanation (c(y bottom, y top,x L, x R)) 
         type='Letters'))) 
mtext(side = 2, "Response", line = 2.3, cex=1.5) 

enter image description here