以下是制作箱线图的脚本:
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轴值更紧密地靠在一起来减少空间,但它并没有改变任何东西。如何才能做到这一点,以减少盒子之间的巨大间隙?
此外,如果有其他减少此图片空白的方法,请分享您的想法。
pdflatex
)总是会导致jpg和png图像的质量损失。恐怕我必须坚持pdf输出。 - Chthonic Project