首先,我想在没有 ggplot 的情况下完成此操作。
我有一个箱线图脚本:
data <- data.frame(
u = c(0.522, 0.488, 0.474, 0.443, 0.510, 0.443, 0.420, 0.554, 0.333, 0.414,
0.467, 0.606, 0.588),
ub = c(0.594, 0.568, 0.578, 0.523, 0.577, 0.501, 0.522, 0.623, 0.498, 0.511,
0.544, 0.654, 0.639),
nu = c(0.646, 0.620, 0.644, 0.607, 0.667, 0.614, 0.631, 0.701, 0.586, 0.589,
0.664, 0.739, 0.744),
nub = c(0.733, 0.701, 0.700, 0.698, 0.724, 0.701, 0.722, 0.777, 0.630, 0.663,
0.703, 0.78, 0.787),
wnub = c(0.815, 0.782, 0.757, 0.764, 0.792, 0.771, 0.838, 0.860, 0.700, 0.703,
0.774, 0.837, 0.863))
boxplot(data, las=1, par(mar=c(7.5, 4.2, 0.25, 0.15)), axes=FALSE, xlab=NA,
ylab=NA, boxwex=.4, outline=FALSE, ylim=c(0:1))
box()
labnames = c("Unigrams",
"Unigrams\n& Bigrams",
"Noun Unigrams",
"Noun Unigrams\n& Noun Bigrams",
"Noun Unigrams\n& Noun Bigrams\n(positional weights)")
axis(side=1, tck=-0.025, labels=FALSE)
axis(side=1, lwd=0, labels=FALSE, at=c(1:5), cex.axis=1)
text(seq(1, 5, by=1), par("usr")[3]-.2, labels=labnames, srt=-90,
xpd=TRUE, adj=.25)
axis(side=2, tck=-0.02, labels=NA)
axis(side=2, lwd=0, cex.axis=1, las=1)
mtext(side=1, "Feature Sets", line=6.5, cex=1.5)
mtext(side=2, "F-Score", line=3, cex=1.5)
产生下图:
我对这种浪费的空白量感到恼火。我一直在尝试减少空间的一种方法是使用“asp”将离散的 x 轴值靠近在一起,但它不会改变任何东西。我怎样才能减少盒子之间的巨大间隙?
另外,如果还有其他方法可以减少图片中的空白,请分享您的想法。