[英]How to add p-value on boxplot using boxplot R command?
I used the boxplot function in R to make boxplots.我使用 R 中的 boxplot 函数来制作箱线图。 And I want to add p-value in my boxplots.
我想在我的箱线图中添加 p 值。 What should I do about it?
我该怎么办? There are methods used ggplot, but I don't want to use ggplot2.
有使用ggplot的方法,但我不想使用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)
Either use mtext
or text
.使用
mtext
或text
。
As you didn't provide final_df
, I just used one of the examples由于您没有提供
final_df
,我只使用了其中一个示例
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")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.