想请教在R中绘制合型图图面上加文字

楼主: hahababa14 (Abby)   2020-12-16 21:49:35
不好意思 请教板上大大,
近日想用R绘制盒型图,
读取数比资料后想在图面上增加注解,
有爬了些文 试用了:text, mtext, annotate
都失败了 想请教大大们有什么建议。
(可能学艺不精,使用后显示text后缺少引数)
BarData <-read.table("C:/Program Files/R/R-3.6.1/INPUTDATA/06010721.txt", head
er=T)
BarData
attach(BarData)
#资料变量的绑定,此次资料变量有Improve、 BarFlatness。
boxplot( BarFlatness ~Improve, boxwex = 0.3, col="lightgray", main = "Bar平面
度" )
#boxplot是盒形的涵数名称,及对应的相关的参数
text( x=0.10, y=0.10,labels="GROUP1")
mtext( x=0.15, y=0.10,labels="GROUP1")
abline( h=0.05, col="red", lty=2 )
#绘制0.05高的红色水平虚线
legend( 0.5, 0.17, legend=c("UCL=0.05","LSL=0.00"), lty=c(2,2), col=c("red","r
ed"),box.lty=0 )
#图中左上水平虚线的的说明
BarSp <- split( BarData, Improve )
BarSp$Before
BarSp$After
BarSp$Before[,2]
BarSp$After[,2]
t.test( BarSp$Before[,2],BarSp$After[,2], alternative="two.sided", var.equal=T
RUE, paired=F, conf.level=0.95 )
再麻烦大大了
作者: cywhale (cywhale)   2020-12-16 22:41:00
如果是boxplot x轴是类别 座标应该是类别 比如下例https://bit.ly/3mnFmYP text(x=c(1:nGroup),...)

Links booklink

Contact Us: admin [ a t ] ucptt.com