I wanted to know how I could change the axis of a plot of Tukey's HSD so I could shorten the words to make each comparison fit and not look ridiculous.
It would help a lot if you could help me with codes for changing axis labels, font size and color.
There are quite a few comparisons in the plot, so I would like to make the significant ones (the comparisons whose intervals are not on the "0" line) stand out more by changing their color.
`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)`
As you can see the axis's are terrible and I want to highlight the significant values outside of the zero interval.
Try this:
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)
You will have something similar to this plot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With