Category Archives: bioinformatics

barplot with different colors

rm(list=ls())
expression = runif(20)
expression = expression[order(expression,decreasing = T)]
types = c(rep(1,times=10),rep(2,times=10))
data = data.frame(expression=expression,types=types)
names = paste(‘exon_’,1:20,sep=””)
rownames(data)=names
barplot(data$expression,col = c(“deepskyblue”,”gray”)[as.factor(data$types)],horiz=F,border = F,las=2,names=rownames(data),xlab=”Splicing genes”,ylab=”conservation scores”,cex.names = 0.6,cex.lab = 1.5)