0

我的箱线图名称很长,并使其垂直切碎这些名称。如何避免箱线图的名称/标签超出绘图区域?

dat <- data.frame(values = rnorm(100), group = gl(2, 50))
levels(dat$group) <- c("reallyreallylonglabel", 
                       "anevenlooooooooooooongerlabel")
boxplot(values ~ group, data = dat,  las = 3)
4

2 回答 2

3

Increase the bottom margin using the par() function.

par(mar=c(14, 3, 1, 1))
boxplot(values ~ group, data=dat, las=3)
于 2013-05-29T17:59:37.543 回答
1

If you use the ggplot library the labels should come out nicely. library(ggplot2)

dat <- data.frame(values = rnorm(100), group = gl(2, 50))
levels(dat$group) <- c("reallyreallylonglabel", 
                       "anevenlooooooooooooongerlabel")


ggplot(dat, aes(factor(group),values)) + stat_boxplot()
于 2013-05-29T18:00:24.470 回答