Re: [R] using color palette in persp

2010-08-18 Thread szisziszilvi

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.

__
R-help@r-project.org 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.


Re: [R] using color palette in persp

2010-08-17 Thread David Winsemius


On Aug 17, 2010, at 10:35 AM, szisziszilvi wrote:



I am using persp to get a plot of a 32x48 matrix.
data - as.matrix(read.table(file=mySample.dat))
persp(data)

And I'm having trouble with trying to give a z-dependent palette to  
it like
rainbow (or any built in one would do). How to combine that with the  
col

argument?


Have you made the effort to work through the examples on the help  
page? The fourth example shows exactly how to do what you are  
requesting.


nice day
Szilvi

--
View this message in context: 
http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2328464.html
Sent from the R help mailing list archive at Nabble.com.

--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org 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.


Re: [R] using color palette in persp

2010-08-17 Thread szisziszilvi

yes, I had, and failed somehow, because I couldn't work out some points. I
don't have my work with me at the moment, but will give a detailed
description about my porblems. I don't remember for sure what I tried and
what not, but I failed at this line:

zfacet - z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]

and I think there must be failures somewhere before - although no warning
messages were found just for this line. Coming back tomorrow (here i'ts
late).
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-color-palette-in-persp-tp2328464p2328843.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.