search for: colsimag

Displaying 1 result from an estimated 1 matches for "colsimag".

Did you mean: colsimage
2012 Jul 17
2
aligning image with bar plot in the same plot
...- c(1.9,0,1.9,2) ## par(mar=mar1) colorsBarPlot <- c(rep('green', 100), rep('blue', 100), rep('black', 100)) barplot(rep(1, 300), space=0, border=NA, col=colorsBarPlot, horiz=T, axes=F) # it works but seems to cumbersome codeCol <- as.numeric(as.factor(colorsBarPlot)) colsImage <- unique(colorsBarPlot) colsBreaks <- sort(unique(c(codeCol-0.5, codeCol+0.5))) image(matrix(codeCol, nrow=1), col=rev(colsImage), breaks=colsBreaks, axes=F) ######### end of code [[alternative HTML version deleted]]