我的箱形图名称很长,并且使这些名称垂直切割。如何避免出自绘图区域的boxplot的名称/标签?
dat <- data.frame(values = rnorm(100), group = gl(2, 50))
levels(dat$group) <- c("reallyreallylonglabel",
"anevenlooooooooooooongerlabel")
boxplot(values ~ group, data = dat, las = 3)
答案 0 :(得分:3)
使用par()函数增加底部边距。
par(mar=c(14, 3, 1, 1))
boxplot(values ~ group, data=dat, las=3)
答案 1 :(得分:1)
如果使用ggplot库,标签应该很好。 库(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()