[R] plot curve on surface
Michael Meyer
spyqqqdia at yahoo.com
Fri Aug 24 11:34:51 CEST 2012
Greetings,
I would like to plot a curve (in color red) on a surface in a 3D plot.
Say
x <- as.vector(seq(-1,1,0.2))
dim(x) <- c(length(x),1)
y <- as.vector(seq(-1,1,0.2))
dim(y) <- c(1,length(y))
z <- x%*%y # (x_iy_j)
# 3D plot of z(x,y)=xy:
persp(x,y,z)
Now I would like to plot the curve z=z(x,x) in red on this surface.
How do I do that?
Many thanks,
Michael Meyer
More information about the R-help
mailing list