[R] rainbow function

David Winsemius dwinsemius at comcast.net
Mon Jan 2 07:43:44 CET 2012


On Jan 2, 2012, at 1:31 AM, 王琦 wrote:

> hello:
> I am trying to use R to draw a  3D picture, then color the picture  
> according to the value of z , how could I do this job?
> this is my exalple
>
> x<-y<-seq(-50,50,2)
> m<-function(x,y) x^3+y^3-x^2*y-x*y^2
> z<-outer(x,y,m)
> persp(x,y,z,theta=-60,phi=30)
>
> I want to draw the Zmax in red and Zmin in blue, the value between  
> Zmax and Zmin is colored gradually

Have you looked at the help(persp) example # 4?

> thank you very much
> 	[[alternative HTML version deleted]]

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list