Barplot

From Augix' Wiki

Jump to: navigation, search
  • put text on the top of the bars
a <- round(runif(100)*10)
y <- table(a)
x <- barplot(y,ylim=c(0,max(y)*1.1))
text(x,y,labels=y,pos=3)


  • cool example
par(las=2,cex=1.5)
ha = c(10,20,100,1,34,24,74)
ca = c(30,20,120,1,44,24,74)
ma = c(3,2,12,1,4,2,7)
m = rbind(ha,ca,ma)
b = c("L1","L2","Alu","r1","r2","r3","rRNA")
cols = c("red","blue","black")
barplot(m,names.arg=b,beside=T,horiz=1,col=cols)
legend("topright",legend=c("human","chimp","rhesus"),pch=15,col=cols)
Personal tools