[R] barplot at specific x values

"Bastian Pöschl" rotate at gmx.li
Thu Nov 12 14:46:23 CET 2009


Dear useRs,

I search for a possibillity to plot stacked bars at specific x positions.
I tried and tried, but the only way i got something adequate was by using lowlevel plots segments(). That is quiet ok, but will not please eyes without a lot of par() lines.

dh<-data.frame(longitude=abs(rnorm(5)),deers=abs(rnorm(5)),humans=abs(rnorm(5)))

plot(dh$longitude,apply(dh[,2:3], 1, sum),type="n",ylim=c(0,max(apply(dh[,2:3], 1, sum))))
segments(dh$longitude,0,dh$longitude,dh$deers, col="green", lwd=12)
segments(dh$longitude,dh$deers,dh$longitude,dh$deers+dh$humans, col="red", lwd=12)

I hope somebody is experienced in doing such plots or somebody just knows how to do it.

Bastian

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser




More information about the R-help mailing list