所以我用以下代码为我的一些数据创建了一个条形图:
plot <- barplot(data,
beside = TRUE,
col = c("red", "blue", "green"),
space = c(0, 0.4),
width = 0.2,
xlim = c(0, 2),
ylim = c(0, 1.1),
legend = c("KNN", "MF1", "MF2"),
args.legend = list(x = 2.7, y = 1.2),
yaxt = 'n',
xpd = TRUE,
srt = 90
)
text(x = plot,
y = data + 0.05,
labels = as.character(round(data, digits = 2)),
srt = 90,
xpd = TRUE
)
我认为情节看起来整洁,但......它不适合该地区(至少我认为)。有没有办法保持图片1中的条形宽度仍然显示所有8组?到目前为止,我的解决方案是减小条的宽度,如图2所示。