I have this data (matrix)
[,1] [,2] [,3] [,4]
[1,] 0.02 0.03 0.03 0.05
[2,] 0.00 0.00 0.04 0.00
[3,] 0.00 0.00 0.03 0.00
[4,] 0.00 0.00 0.06 0.00
[5,] 0.00 0.00 0.07 0.00
I have tried different compbinations of colours non of them works.
I would like to have the first 2 bars to be in blue
, the third to be in these colours
colr <- c("red","yellow","green","yellow","red")
and last column in blue
I have tried even to define matrix of colours:
colr <- cbind(c("blue","white","white","white","white"),
c("blue","white","white","white","white"),
c("red","yellow","green","yellow","red"),
c("blue","white","white","white","white"),
c("blue","white","white","white","white"))
barplot(as.matrix(x), col=colr)
Please use only base R
barplot for solution. Thank you.