Reputation: 31
I used the boxplot function in R to make boxplots. And I want to add p-value in my boxplots. What should I do about it? There are methods used ggplot, but I don't want to use ggplot2. my code is :
boxplot(wbc~Vital_status,
data=final_df$ximp,
main="boxplots of wbc ",
xlab="Vital status",
ylab="wbc",
col="orange",
border="brown",
outline=FALSE,boxwex=.5, xaxt='n', frame=FALSE
)
axis(side = 1,at = 0:3,labels=c("", "alive", "dead", ""),lwd.ticks = FALSE)
Upvotes: 1
Views: 775
Reputation: 903
Either use mtext
or text
.
As you didn't provide final_df
, I just used one of the examples
boxplot(len ~ dose:supp, data = ToothGrowth,
boxwex = 0.5, col = c("orange", "yellow"),
main = "Guinea Pigs' Tooth Growth",
xlab = "Vitamin C dose mg", ylab = "tooth length",
sep = ":", lex.order = TRUE, ylim = c(0, 35), yaxs = "i")
mtext("p=0.05", side=3)
text(x=3,y=30,labels="p=0.05")
Upvotes: 1