简体   繁体   English

R中倍数图的单独标题

[英]seperate titles of multiples plots in R

I plot 5 boxplots (boxplot) in two rows with par(mfrow = c(2,5), oma = c(0,0,2,2)) . 我用par(mfrow = c(2,5), oma = c(0,0,2,2))在两行中绘制5个箱线图par(mfrow = c(2,5), oma = c(0,0,2,2))

par(mfrow = c(2,5),oma = c(0, 2, 2, 0))
boxplot(x,...)
title (main = "title1", outer = T)
boxplot(y,...)
title (main = "title2", outer = T)#overwrites title 1

how to place the title2 above the 2nd row of boxplots? 如何将title2放在框线的第二行上方?

You can use mtext to plot the title wherever you want. 您可以使用mtext在任意位置绘制标题。

data("mtcars")
par(mfrow = c(2,5),oma = c(0, 2, 2, 0))
replicate(10,boxplot( mpg~cyl,mtcars))
mtext("title1",line = 0,outer=T,font = 2)
mtext("title2",line = -24,outer=T,font = 2)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM