How to use `image` to display a matrix in its conventional layout?
I have a matrix defined as follows dataMatrix <- matrix(rnorm(400), nrow=40) then dataMatix is plotted to the screen using the following image(1:10, 1:40, t(dataMatrix)[, nrow(dataMatrix):1]) can someone explain how the third argument of the image function works ? I'm particularly confused by what happens inside [] . Thanks There is nothing better than an illustrative example. Consider a 4 * 2 integer matrix of 8 elements: d <- matrix(1:8, 4) # [,1] [,2] #[1,] 1 5 #[2,] 2 6 #[3,] 3 7 #[4,] 4 8 If we image this matrix with col = 1:8 , we will have a one-to-one map between colour and pixel: