[R] persp plot increasing 'x' and 'y' values expected

Michael Dondrup michael.dondrup at cebitec.uni-bielefeld.de
Tue Apr 25 12:23:34 CEST 2006

```Hi,
of course it can't because the number of unique values is different. You need
a unique _combination_ of x,y and hopefully you don't have different z values
for any such a pair. try:

xyz <- unique(cbind(x,y,z))
persp(xyz)

If you still get the err, then you had different measurements for the same
point.
Cheers

Am Tuesday 25 April 2006 12:24 schrieb voodooochild at gmx.de:
> hi peter,
>
> ok, i see the problem, but if i do
>
> x<-unique(data\$x)
> y<-unique(data\$y)
> z<-matrix(unique(data\$z),length(y),length(x))
>
> it also doesn't work.
>
> i want to do a plot, where i can see, how x and y influences z.
>
> P Ehlers wrote:
> > voodooochild at gmx.de wrote:
> >> hello,
> >>
> >> i do the following in order to get an persp-plot
> >>
> >> x<-c(2,2,2,2,2,2,3,3,3,3)
> >> y<-c(41,41,83,83,124,166,208,208,208,208)
> >> z<-c(90366,90366,92240,92240,92240,96473,100995,100995,100995,100995)
> >> x<-data\$x
> >> y<-data\$y
> >> z<-matrix(data\$z,length(y),length(x))
> >> persp(x,y,z, col="gray")
> >>
> >> but i always get the error message increasing 'x' and 'y' values
> >> expected, but i think my data values are already increasing, what is
> >> wrong?
> >
> > I'm not sure what your data\$x, data\$y, data\$z are (but I can guess).
> > Why do you think that your x is *increasing*? Is x[i+1] > x[i]?
> > Does diff(x) yield only positive values?
> >
> > What kind of a perspective plot do you expect? You seem to have only
> > 5 unique points.
> >
> > Peter Ehlers
> >
> >> best regards
> >> andreas
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help