R 如何使用fix wieght和正确的标签绘制箱线图?
我写了这段代码,但我不能固定盒子部分的宽度,最近标签垂直显示!但昨天它的工作是正确的R 如何使用fix wieght和正确的标签绘制箱线图?,r,boxplot,R,Boxplot,我写了这段代码,但我不能固定盒子部分的宽度,最近标签垂直显示!但昨天它的工作是正确的 dt=rnorm(100) l=c("min:","1st Qu:","median:","3rd Qu:","max:") bxp <- boxplot(dt, axes=TRUE,col = '#fb9a99') v=round(bxp$stats,2) mtext(paste(l,v),side = 4, at=bxp$stats[c(1,2,3,4,5)], line=-5.5) 为了再现性,请
dt=rnorm(100)
l=c("min:","1st Qu:","median:","3rd Qu:","max:")
bxp <- boxplot(dt, axes=TRUE,col = '#fb9a99')
v=round(bxp$stats,2)
mtext(paste(l,v),side = 4, at=bxp$stats[c(1,2,3,4,5)], line=-5.5)
为了再现性,请使用set.seed函数
# set seed
set.seed(1980)
# your data and text
dt <- rnorm(100)
l <- c("min:", "1st Qu:", "median:", "3rd Qu:", "max:")
# your boxplot
# with boxwex parameter you control the width of the boxes
bxp <- boxplot(dt,
axes = TRUE,
col = '#fb9a99',
boxwex = 0.5)
v <- round(bxp$stats, 2)
# your text
# with las parameter you control orientation of the text
mtext(paste(l, v),
side = 4,
at = bxp$stats[c(1, 2, 3, 4, 5)],
line = -10.5,
las = 1)
在多行文字中使用las=2水平绘制文字。首先,谢谢,其次,您知道如何减少方框图和帧轴之间的空间=真吗?内部空间不在外面看看PAR功能…特别是控制绘图页边距的参数。。。。