Aaaah...the inner workings of R! Now I also see why the colours are not only repeated, but also 'wrongly' allocated to the facets! Very clear example!

Indeed a warning or error would have been more helpful!

Cheers,

Sander.

PS: I hope that after all this, I can still convince the creator of the original data that it is a good idea to plot his graphs in R instead of excel. ;-)


Duncan Murdoch wrote:

On Wed, 16 Feb 2005 15:44:00 +0200, Sander Oom
<[EMAIL PROTECTED]> wrote :



Thanks Peter!

Of course I only have (nx-1)(ny-1) facets in a x*y plot!

The help page line:
...
col the color(s) of the surface facets. Transparent colours are ignored. This is recycled to the (nx-1)(ny-1) facets.
...
just did not ring a bell.


In fact, it is still not clear to me why it recycles the ramp even though it has a surplus of colours (grey levels)! Why not just ignore the surplus colours?



Your z array is 6 by 7. Your cols will be mapped to a 5 by 6 array. They don't look like an array, because the grey() function stripped off the dimension attribute.

The problem is that if you pass the entries from a 6 by 7 array to
something that expects the entries from a 5 by 6 array, you get things
in the wrong order.   You see the same effect here:



rownum <- as.vector(row(matrix(NA, 6, 7)))
matrix(rownum, 6, 7)


[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1 1 1 1 1 1 1
[2,] 2 2 2 2 2 2 2
[3,] 3 3 3 3 3 3 3
[4,] 4 4 4 4 4 4 4
[5,] 5 5 5 5 5 5 5
[6,] 6 6 6 6 6 6 6


matrix(rownum, 5, 6)


[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 6 5 4 3 2
[2,] 2 1 6 5 4 3
[3,] 3 2 1 6 5 4
[4,] 4 3 2 1 6 5
[5,] 5 4 3 2 1 6
Warning message:
data length [42] is not a sub-multiple or multiple of the number of
rows [5] in matrix


except that in this case you get a warning about the wrong length;
persp doesn't give you the warning.  Maybe it should?

Duncan Murdoch





-- --------------------------------------------------------- Dr. Sander P. Oom Animal, Plant and Environmental Sciences University of the Witwatersrand Private Bag 3 Wits 2050 South Africa

Tel (work)      +27 (0)11 717 64 04
Tel (home)      +27 (0)18 297 44 51
Fax             +27 (0)18 299 24 64

Email   [EMAIL PROTECTED]
Web     www.oomvanlieshout.net/sander

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to