1

I am plotting a barchart and face the following problem:

The barchart consists of negative and positive values. I want to show these values at the end each bar. When I choose pos=4 the positive values show up nicely but the negative ones are not so nice. When I choose pos=2 the same problem occurs vice versa...

What can I do... Please find my lines attached:

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)

All other things work fine.

rcs
  • 67,191
  • 22
  • 172
  • 153
Lasse
  • 11
  • 1
  • 2
    Could you include data? See: [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – ROLO Sep 16 '13 at 09:06

0 Answers0