在 Rstudio 中修改 Tukey HSD 95% 系列 CL 图
Modifying a Tukey HSD 95% family-wise CL plot in Rstudio
我想知道如何更改 Tukey 的 HSD 绘图的轴,以便我可以缩短单词以使每个比较合适而不是看起来很荒谬。
如果你能帮我提供更改轴标签、字体大小和颜色的代码,那将会很有帮助。
图中有很多比较,所以我想通过更改颜色使重要的(间隔不在“0”线上的比较)更加突出。
`Gastropods = read.csv(file = "MaroubraZones.csv", header = TRUE)
boxplot(Abundance ~ Zone*Species,data = Gastropods, names = c("A.high", "A.mid", "A.low", "C.high", "C.mid", "C.low", "N.high", "N.mid", "N.low"))
Gastropods.ANOVA = aov(Abundance ~ Zone * Species, data = Gastropods)
hist(Gastropods.ANOVA$residuals)
plot(Gastropods.ANOVA)
Gastropods$LOGAbundance = log10(Gastropods$Abundance + 1)
Gastropods$SQRTAbundance = sqrt(Gastropods$Abundance + 1)
summary(Gastropods.ANOVA)
summary(Gastropods$SQRTAbundance.ANOVA)
interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$Abundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of Gastropod Abundance",legend = FALSE))
interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$Abundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of Gastropod Abundance", legend = FALSE)
TukeyHSD(Gastropods.ANOVA)
tuk<-TukeyHSD(Gastropods.ANOVA)
plot(tuk)`
如您所见,轴很糟糕,我想突出显示零区间之外的重要值。
试试这个:
TukeyHSD(Gastropods.ANOVA)
tuk<-TukeyHSD(Gastropods.ANOVA)
psig=as.numeric(apply(tuk$`Zone:Species`[,2:3],1,prod)>=0)+1
op=par(mar=c(4.2,9,3.8,2))
plot(tuk,col=psig,yaxt="n")
for (j in 1:length(psig)){
axis(2,at=j,labels=rownames(tuk$`Zone:Species`)[length(psig)-j+1],
las=1,cex.axis=.8,col.axis=psig[length(psig)-j+1])
}
par(op)
你会有类似这个情节的东西
我想知道如何更改 Tukey 的 HSD 绘图的轴,以便我可以缩短单词以使每个比较合适而不是看起来很荒谬。
如果你能帮我提供更改轴标签、字体大小和颜色的代码,那将会很有帮助。
图中有很多比较,所以我想通过更改颜色使重要的(间隔不在“0”线上的比较)更加突出。
`Gastropods = read.csv(file = "MaroubraZones.csv", header = TRUE)
boxplot(Abundance ~ Zone*Species,data = Gastropods, names = c("A.high", "A.mid", "A.low", "C.high", "C.mid", "C.low", "N.high", "N.mid", "N.low"))
Gastropods.ANOVA = aov(Abundance ~ Zone * Species, data = Gastropods)
hist(Gastropods.ANOVA$residuals)
plot(Gastropods.ANOVA)
Gastropods$LOGAbundance = log10(Gastropods$Abundance + 1)
Gastropods$SQRTAbundance = sqrt(Gastropods$Abundance + 1)
summary(Gastropods.ANOVA)
summary(Gastropods$SQRTAbundance.ANOVA)
interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$Abundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of Gastropod Abundance",legend = FALSE))
interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$Abundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of Gastropod Abundance", legend = FALSE)
TukeyHSD(Gastropods.ANOVA)
tuk<-TukeyHSD(Gastropods.ANOVA)
plot(tuk)`
如您所见,轴很糟糕,我想突出显示零区间之外的重要值。
试试这个:
TukeyHSD(Gastropods.ANOVA)
tuk<-TukeyHSD(Gastropods.ANOVA)
psig=as.numeric(apply(tuk$`Zone:Species`[,2:3],1,prod)>=0)+1
op=par(mar=c(4.2,9,3.8,2))
plot(tuk,col=psig,yaxt="n")
for (j in 1:length(psig)){
axis(2,at=j,labels=rownames(tuk$`Zone:Species`)[length(psig)-j+1],
las=1,cex.axis=.8,col.axis=psig[length(psig)-j+1])
}
par(op)
你会有类似这个情节的东西