[R] re-arranging data to create an image (or heatmap)

pierz s.piersma at gmail.com
Tue Mar 8 15:23:35 CET 2011


I have now advanced to image.plot from the "fields" package, which gives a
nice color scalebar:

image.plot(dat,col=imagecolsmat,xlab="time",ylab="abs")

All that is left now is to change the scale on the x and y axis from 0 to 1
to the actual values. I do not understand why it does not read the proper
values from my data matrix. Here is the first part of it:

dat[1:10,1:10]

             abs
time          5 6 7 8 9 10 11 12 13 14
  0.248175182 1 0 1 0 0  0  0  0  0  0
  0.372262774 1 0 1 0 0  0  0  0  0  0
  0.496350365 1 0 1 0 0  0  0  0  0  0
  0.620437956 2 0 1 0 0  0  0  0  0  0
  0.744525547 2 1 0 0 0  0  0  0  0  0
  0.868613139 2 1 0 0 0  0  0  0  0  0
  0.99270073  0 2 1 0 0  0  0  0  0  0
  1.116788321 0 3 0 0 0  0  0  0  0  0
  1.240875912 0 1 2 0 0  0  0  0  0  0
  1.364963504 0 0 1 3 1  0  0  0  0  0

It seems as if the first row and column are disregarded and the data is
rescaled to fit between 0 and 1. It seems I'm so close, but I can't seem to
figure this one out... This is what I get so far:
http://r.789695.n4.nabble.com/file/n3341466/test.jpg 

--
View this message in context: http://r.789695.n4.nabble.com/re-arranging-data-to-create-an-image-or-heatmap-tp3327986p3341466.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list