barplot 中的 xlab 和 ylab 未显示

xlab and ylab in barplot not being displayed

所以我在 barplot 函数中为 xlabylab 都指定了一些字符串,但由于某些原因我没有显示它们。另外,我指定了 beside=T 并且条形图没有并排放置。这是代码:

barplot(height=c(mean(d2$tconv[d2$NFUP==1]), mean(d2$tconv[d2$FUP==1])),
        col = c(2,3), names.arg=levels(d$progu1), 
        main="Tiempo de Conversión según si el usuario convertido ha acabado la 1era Unidad",
        ylim=c(0,max(mean(d2$tconv[d2$FUP==1]), mean(d2$tconv[d2$NFUP==1]))+10),
        xlab="Uso", ylab="Tiempo hasta Conversión", border=F, beside=T)

这是结果。缩放没有帮助:

要了解 beside = T 的工作原理,请检查以下内容:

counts <- table(mtcars$vs, mtcars$gear)


barplot(counts, main="Car Distribution by Gears and VS",
        xlab="Number of Gears", col=c("darkblue","red"),
        legend = rownames(counts), beside=TRUE)


barplot(counts, main="Car Distribution by Gears and VS",
        xlab="Number of Gears", col=c("darkblue","red"),
        legend = rownames(counts), beside=FALSE)


barplot(counts[2,], main="Car Distribution by Gears and VS",
        xlab="Number of Gears", col=c("darkblue","red"),
        legend = rownames(counts), beside=TRUE)

尝试设置更大的页边距。例如:

par(mar=c(4,4,4,4))

您可以致电查询当前保证金:

par()