Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何使用fix wieght和正确的标签绘制箱线图?_R_Boxplot - Fatal编程技术网

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功能…特别是控制绘图页边距的参数。。。。