Skip to content
Prev 304171 / 398513 Next

Aligning barplot

I was able to do this, but kinda painful:

BagA <- c(-1000,10,10,10,10,10,10,
          10,20,20,20,20,20,20,30,
          30,40,40,50,60)


BagB <- c(10,20,30,30,40,40,50,50,
          50,50,50,50,60,60,60,60,
          60,60,60,1000)

tblA <- table(BagA)
tblAnames  <- names(tblA)
tblA <- as.vector(tblA)
tblA[8] <- 0
names(tblA) <- c(tblAnames,"1000")

tblB <- table(BagB)
tblBnames  <- names(tblB)
tblB <- as.vector(tblB)
tblB <- c(0,tblB)
names(tblB) <- c("-1000",tblBnames)

layout(c(2,1))

barplot(tblB)
barplot(tblA)

Any better ideas?


darnold wrote
--
View this message in context: http://r.789695.n4.nabble.com/Aligning-barplot-tp4641356p4641357.html
Sent from the R help mailing list archive at Nabble.com.