본문 바로가기

R관련

Color scale bar function

728x90
반응형

color.scaleBAR <- function(colors, min, max=-min, nticks=11, ticks=seq(min, max, len=nticks), title='',digits=2){

  scale = (length(colors)-1)/(max-min)

  plot(c(0,10), c(min,max), type='n', bty='n', xaxt='n', xlab='', yaxt='n', ylab='', main=title)

  axis(2, round(ticks,digits), las=1)

  for (i in 1:(length(colors)-1)) {

    y = (i-1)/scale + min

    rect(0,y,10,y+1/scale, col=colors[i], border=NA)

  }

}

728x90
반응형

'R관련' 카테고리의 다른 글

Rentrez package update symbol and get entrezID  (0) 2019.02.14
calculate GSEA Enrichment score  (0) 2019.02.13
proportion test  (0) 2019.01.23
DLL 관련 해결법  (0) 2018.06.29
microarray (affymetrix, illumina)  (0) 2018.03.28