There is an error in your code: in persp(x , y , z) the length of x is the number of rows of z, the length of y is the number of columns of z, You should also name the rows and columns in z with x and y
Economics Guy wrote: > > I am having some trouble getting the persp() package to change the x > and y axis on a 3d plot. It defaults to the [0,1] interval and when I > try to change it I get errors. > > Example: > > This works: > ------------ > D <- c(1,2,3,4,5,6,7,8,9,10) > M <- c(11,12,13,14,15,16,17,18,19,20) > > DM <- cbind(D,M) > > persp(DM, theta = 40, phi = 30, expand = 0.5, col = "lightblue", > ltheta = 120, shade = 0.75, ticktype = "detailed", > xlab = "X", ylab = "Y", zlab = "Z") > --------------------- > > > But I want the axis to count 1 by ones. So I try: > ----------------- > D <- c(1,2,3,4,5,6,7,8,9,10) > M <- c(11,12,13,14,15,16,17,18,19,20) > > DM <- cbind(D,M) > > x <- 1*0:10 > y <- 1*0:20 > persp(x,y,DM, theta = 40, phi = 30, expand = 0.5, col = "lightblue", > ltheta = 120, shade = 0.75, ticktype = "detailed", > xlab = "X", ylab = "Y", zlab = "Z") > ------------------------- > > I get: > > Error in persp(x, y, z, xlim, ylim, zlim, theta, phi, r, d, scale, > expand, : invalid 'z' argument > > but the z was fine in the first version so I am not sure what the deal is. > > Any ideas? > > -Econ Guy > > ______________________________________________ > [EMAIL PROTECTED] 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. > > -- View this message in context: http://www.nabble.com/persp%28%29-problem-tf4417956.html#a12617657 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.