[R] using color palette in persp

szisziszilvi sziszi.szilvi at gmail.com
Wed Aug 18 09:37:07 CEST 2010


I remembered wrong, the problem rised int the next line to the mentioned one,
z was wrong, and I didn't see way. But new day, new point of wiew. For
anybody's interest here is the solution.

The original try was this:

x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 35)
z <- as.matrix(read.table(file="mSample.dat")) # mSample.dat looks like
this: "   104  107" (... 32l, 48c)
... (the same as in the example) ...
persp(x, y, z, col=color[facetcol], phi=30, theta=-30)

And it's wrong at the first three line. Now obviously, because z won't be a
30x35 matrix, but just az large as it's determined in the file. So I placed
the first lines with this:

z <- as.matrix(read.table(file="mSample.dat"))
x <- seq(1, nrow(z))
y <- seq(1, ncol(z))

which is probably better in this case, because the z values are not
calculated from x and y, so it's no point to determine their lenghts
manually.
-- 
View this message in context: http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2329451.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list