Thanks Thomas, My data arrays each contain 0.5million data points so I couldn't really reproduce them unfortunately. Next time I will try and offer some exapmle code simplified with comments in order to help you and the others on R-help understand my problem more easily. I appreciate your help and advise and I know it will be very usefull in learning about handling these huge datasets more accurately.
Jenny > >the transform that i provided orientates the data matrix so that when plotted with image >or levelplot the result is isomorphic to what you see when you print the >matrix at the r >prompt. > >i don't know what your data look like---"commented, minimal, self-contained, reproducible >code" would help---but you should be able to work out exactly what way you >want your data >to appear by playing with the example code. i would advise you to produce a data matrix >the way you want to see it on the screen, just like the matrix m in the >example code, and >then view the output with levelplot(inverse(m)), in which case, the answer to your >question is you only need to transform the data with inverse() once you get your data >matrix to look the way you want at the r prompt. > > >--- Jenny Barnes <[EMAIL PROTECTED]> wrote: > >> Thomas, >> >> Thank you for this example, makes it easier to see what levelplot does - >> does >> this mean that EVERY time I want to plot with levelplot() I have to not only >> reverse the columns [,ncol(output.temp):1] but also have to transform the matrix >> as below? I am only suprised as I don't remember having read about this in the >> R-info in ?levelplot or R-help website and it seems like a fundamental thing to >> know if using levelplot! >> >> Thanks, >> >> Jenny >> >> > >> > rm(list=ls(all=TRUE)) >> > graphics.off() >> > # make a test matrix: >> > nr<- 3 >> > nc<- 4 >> > # the data: >> > ( m<- matrix((1:(nr*nc)), nr, nc) ) >> > [,1] [,2] [,3] [,4] >> > [1,] 1 4 7 10 >> > [2,] 2 5 8 11 >> > [3,] 3 6 9 12 >> > >> > # the way that levelplot (and image) displays the data: >> > t(m)[dim(t(m))[1]:1, ] >> > [,1] [,2] [,3] >> > [1,] 10 11 12 >> > [2,] 7 8 9 >> > [3,] 4 5 6 >> > [4,] 1 2 3 >> > >> > # undo what levelplot does by performing the inverse transformation >> > inverse<- function(x) t(x[dim(x)[1]:1, ]) >> > >> > windows(); levelplot(m, main="levelplot(m)") >> > windows(); levelplot(inverse(m), main="levelplot(inverse(m))") >> > >> > > Message: 7 >> > > Date: Mon, 11 Dec 2006 12:28:17 +0000 (GMT) >> > > From: Jenny Barnes <[EMAIL PROTECTED]> >> > > Subject: [R] upside down image/data >> > > To: [email protected] >> > > Message-ID: <[EMAIL PROTECTED]> >> > > Content-Type: TEXT/plain; charset=us-ascii >> > > >> > > Dear R-community, >> > > >> > > I am looking for some simple advice - I have a matrix (therefore 2 >> dimensional) >> > > of global temperature. >> > > >> > > Having read R-help I think that when I ask R to image() or >> > levelplot() >> my matrix >> > > will it actually appear upside down - I think I therefore need to use >> the line: >> > > > levelplot(temperature.matrix[,ncol(output.temp):1], ........) >> > > to get it looking like it was on the globe due to the matrix rows >> increasing in >> > > number down the matrix in its dimensions on longitude and latitude >> > but >> the >> > > y-axis coordinates increase up the axis. >> > > >> > > Can anyone simply tell me whether this is correct as I find it very >> hard to know >> > > which way up my data should be and I cannot tell which is correct >> simply by >> > > looking at it! >> > > >> > > Many thanks for your time in reading this problem, >> > > >> > > Jenny Barnes >> > >> > >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> Jennifer Barnes >> PhD student - long range drought prediction >> Climate Extremes >> Department of Space and Climate Physics >> University College London >> Holmbury St Mary, Dorking >> Surrey >> RH5 6NT >> 01483 204149 >> 07916 139187 >> Web: http://climate.mssl.ucl.ac.uk >> >> >> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jennifer Barnes PhD student - long range drought prediction Climate Extremes Department of Space and Climate Physics University College London Holmbury St Mary, Dorking Surrey RH5 6NT 01483 204149 07916 139187 Web: http://climate.mssl.ucl.ac.uk ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
