On Thu, Jun 09, 2011 at 01:50:17PM +0200, Uwe Ligges wrote: > > > On 09.06.2011 13:37, oliver wrote: > >On Thu, Jun 09, 2011 at 11:22:54AM +0200, Uwe Ligges wrote: > >>Well, > >> > >>persp(x, y, z) does exactly what you asked for: it plots tha matrix > >>z along the values given by the vectors x and y. > > > >But I don't have these vectors x and y, so I have to > >create them just to call persp(). > >And persp also needs the values only to rise. > > > >But if I have x and y, and I want to have only rising numbers for x and y,m > >I need somehow to create those values, and expand.grid() > >would not create value combinations that are only rising. > >(Or did I miss an option for expand.grid, which does that?) > > > >>If you need to calculate z values from x and y using some function > >>foo, outer(x, y, foo) is typically your friend. > > > >OK. > > > >And what, if I want to generate the mathcing x- and y- values > >for a matrix, that has x- and y implicitly, but I only have the > >z-values inside the matrix? > > > >So, my problem is the other way around. > >I don't want to calc the z for my x-and y, I want to generate the x- > >and y- values for my matrix of z-values. > > > Actually you just need to pass the matrix Z if the scale of the axes > is irrelevant: > > persp(Z) [...]
nice. Thank you! (this also works with rgl::persp3d() which I like even more) You made my day! :) Ciao, Oliver ______________________________________________ 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.