Hello folks,

i'm a R beginner and i want to put in a same plot both contour lines and persp plot.

For example,

fn<-function(x,y){sin(x)+2*y} #this looks like a corrugated tin roof

x<-seq(from=1,to=100,by=1) #generates a list of x values to sample
y<-seq(from=1,to=100,by=1) #generates a list of y values to sample

z<-outer(x,y,FUN=fn) #applies the funct. across the combos of x and y

persp(z) #plots without gridlines
contour(z) # for contour lines

i want this in a same plot.
Can anyone help me, i have no more idea to try this.

Thanks

______________________________________________
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.

Reply via email to