R条形图显示数值

R条形图显示数值,r,bar-chart,R,Bar Chart,我正在绘制条形图,面临以下问题: 条形图由负值和正值组成。我想在每个栏的末尾显示这些值。当我选择pos=4时,正值显示得很好,但负值不太好。当我选择pos=2时,同样的问题也会出现,反之亦然 我能做什么。。。请查看附件中的我的台词: par(pin=c(9,9), mar=c(1,12,1,1), col=c(rgb(126,126,126,maxColorValue=255)), xpd=F) PBG <- barplot(Gewicht_tsr, beside=T, horiz=T,

我正在绘制条形图,面临以下问题:

条形图由负值和正值组成。我想在每个栏的末尾显示这些值。当我选择pos=4时,正值显示得很好,但负值不太好。当我选择pos=2时,同样的问题也会出现,反之亦然

我能做什么。。。请查看附件中的我的台词:

par(pin=c(9,9), mar=c(1,12,1,1), col=c(rgb(126,126,126,maxColorValue=255)), xpd=F)
PBG <- barplot(Gewicht_tsr, beside=T, horiz=T, space= c(.5,1), las=2,
               cex.name=0.7, xlim=c(min(Gewicht_d)*1.7, max(Gewicht_d)*1.7),
               border=NA, axes=F, main="Sektoren Gewichtung", 
               col=c(rgb(206,165,90,maxColorValue=255),
                     rgb(180,169,162,maxColorValue=255),
                     rgb(0,116,77,maxColorValue=255)), 
               col.axis=c(rgb(126,126,126,maxColorValue=255)),
               col.main=c(rgb(126,126,126,maxColorValue=255)), width=.8)
legend("bottomright", legend=c("Portfolio", "Benchmark", "Aktiv"),
       ncol=3, pch=15, bty="n",
       col=c(rgb(0,116,77,maxColorValue=255),
             rgb(180,169,162,maxColorValue=255),
             rgb(206,165,90,maxColorValue=255)),
       cex=0.7)
y <- (as.matrix(Gewicht_tsr [,1:ncol(Gewicht_tsr)]))
text(y,PBG, labels=as.character(y), cex=0.62, pos=4)
所有其他东西都很好。

您能提供数据吗?请参阅:。