Re: [R] persp plot + plotting grid lines

2009-03-15 Thread Duncan Murdoch
On 15/03/2009 10:07 AM, Kingsford Jones wrote: Building on Duncan's code, here's an approximation to the Matlab 'peaks' plot referred to by Pedro: peaks <- function(x, y) { 3 * (1-x)^2 * exp(-(x^2)-(y+1)^2) - 10 * (x/5-x^3-y^5) * exp(-x^2-y^2) - 1/3*exp(-(x+1)^2-y^2)} x <- y <- seq(-3,3,.1)

Re: [R] persp plot + plotting grid lines

2009-03-15 Thread Kingsford Jones
Building on Duncan's code, here's an approximation to the Matlab 'peaks' plot referred to by Pedro: peaks <- function(x, y) { 3 * (1-x)^2 * exp(-(x^2)-(y+1)^2) - 10 * (x/5-x^3-y^5) * exp(-x^2-y^2) - 1/3*exp(-(x+1)^2-y^2)} x <- y <- seq(-3,3,.1) z <- outer(x,y, peaks) z2 <- 10 * round(c(z) + ab

Re: [R] persp plot + plotting grid lines

2009-03-15 Thread David Winsemius
This wiki page has the answer. Draw the plot first to establish the coordinate system and create the viewing transformation matrix. Draw the grid lines with lines(trans3d()), and then put a: par(new=T) ... and then redraw the plot over the gridlines.

Re: [R] persp plot + plotting grid lines

2009-03-14 Thread Duncan Murdoch
On 14/03/2009 12:02 PM, Pedro Mardones wrote: Dear all; Does anyone know how to add grid lines to a persp plot? I've tried using lines(trans3d..) but the lines of course are superimposed into the actual 3d surface and what I need is something like the plot shown in the following link: http://ther

Re: [R] persp plot + plotting grid lines

2009-03-14 Thread David Winsemius
On Mar 14, 2009, at 12:02 PM, Pedro Mardones wrote: Dear all; Does anyone know how to add grid lines to a persp plot? I've tried using lines(trans3d..) but the lines of course are superimposed into the actual 3d surface and what I need is something like the plot shown in the following link: htt

Re: [R] persp plot + plotting grid lines

2009-03-14 Thread David Winsemius
Ideas... not a solution. Plot the grid within your ranges using something along the lines, literally and figuratively, based on the second example of persp's help pages. For the z=8 grid lines on that example you could use: for (ix in seq(-10,10, by=5)) lines (trans3d(x=ix, y=seq(-10,10,

[R] persp plot + plotting grid lines

2009-03-14 Thread Pedro Mardones
Dear all; Does anyone know how to add grid lines to a persp plot? I've tried using lines(trans3d..) but the lines of course are superimposed into the actual 3d surface and what I need is something like the plot shown in the following link: http://thermal.gg.utah.edu/tutorials/matlab/matlab_tutorial

Re: [R] persp plot

2008-06-25 Thread Ben Bolker
Chad Junkermeier byu.edu> writes: > > I have a set of data in the form > x1, y1, z1 > x1, y2, z2 > ... > x1, yN, zN > x2, y1, z(N+1) > x2, y2, z(N+2) > ... > x2, yN, z(2N) > ...and so on... > xM, yN, val(M*N) > > Do you have any suggestions? Not at all carefully tested, but: ## make up dat

Re: [R] persp plot

2008-06-24 Thread Chad Junkermeier
IL PROTECTED] ] On Behalf Of Chad Junkermeier Sent: Tuesday, June 24, 2008 7:39 AM To: r-help@r-project.org Subject: [R] persp plot I have a set of data in the form x1, y1, z1 x1, y2, z2 ... x1, yN, zN x2, y1, z(N+1) x2, y2, z(N+2) ... x2, yN, z(2N) ...and so on... xM, yN, val(M*N) I have be

[R] persp plot

2008-06-24 Thread Chad Junkermeier
I have a set of data in the form x1, y1, z1 x1, y2, z2 ... x1, yN, zN x2, y1, z(N+1) x2, y2, z(N+2) ... x2, yN, z(2N) ...and so on... xM, yN, val(M*N) I have been trying to figure out how to get R to use this data in a persp plot. So far the only thing that I can figure out to do is to break