[R] [RGL] Need help to modify current plot

2010-05-18 Thread Megh Dal
Dear folks, I have created a plot on RGL device :
 
x = 1:6
y = seq(-12, 5, by=1)
z = matrix(0, length(y), length(x))
z[13,3] = 1; z[13,4] = 1.011765
surface3d(x, y, t(z), col=rainbow(1000))
grid3d(c(x-, y-, z))
 
Now I want to draw 2 lines along x=3  x=4, over the surface (with different 
colour). Could somebody help me how to draw that?
 
Thanks,


  
[[alternative HTML version deleted]]

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


Re: [R] [RGL] Need help to modify current plot

2010-05-18 Thread Duncan Murdoch

Megh Dal wrote:

Dear folks, I have created a plot on RGL device :
 
x = 1:6

y = seq(-12, 5, by=1)
z = matrix(0, length(y), length(x))
z[13,3] = 1; z[13,4] = 1.011765
surface3d(x, y, t(z), col=rainbow(1000))
grid3d(c(x-, y-, z))
 
Now I want to draw 2 lines along x=3  x=4, over the surface (with different colour). Could somebody help me how to draw that?
 
  


x=3 and x=4 specify planes, not lines, so you'll need to give more 
information to choose lines.  Here's one possibility:


save - par3d(ignoreExtent=TRUE)
segments3d(c(3,3,4,4), c(min(y), max(y), min(y), max(y)), c(max(z), 
max(z), max(z), max(z)), col=red)

par3d(save)

Duncan Murdoch

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


Re: [R] [RGL] Need help to modify current plot

2010-05-18 Thread Duncan Murdoch

On 18/05/2010 6:46 AM, Megh Dal wrote:

Thanks Duncan for your reply. This could definitely be an answer of my query 
however I wanted something else. What I want is to draw 2 lines over the 
surface which pass through x=3,4
  


That's even more ambiguous than your original request, so I won't try to 
code it.  The general solution to draw a line segment is to work out end 
points (x1,y1,z1) and (x2,y2,z2), and then call


segments3d(c(x1,x2), c(y1,y2), c(z1, z2), ...)

where the ... specifies things like the colour, etc.

Duncan Murdoch
 
Any better idea?
 
Thanks,

--- On Tue, 5/18/10, Duncan Murdoch murdoch.dun...@gmail.com wrote:


From: Duncan Murdoch murdoch.dun...@gmail.com
Subject: Re: [R] [RGL] Need help to modify current plot
To: Megh Dal megh700...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, May 18, 2010, 3:51 PM


Megh Dal wrote:
  

Dear folks, I have created a plot on RGL device :
  x = 1:6
y = seq(-12, 5, by=1)
z = matrix(0, length(y), length(x))
z[13,3] = 1; z[13,4] = 1.011765
surface3d(x, y, t(z), col=rainbow(1000))
grid3d(c(x-, y-, z))
  Now I want to draw 2 lines along x=3  x=4, over the surface (with different 
colour). Could somebody help me how to draw that?




x=3 and x=4 specify planes, not lines, so you'll need to give more information 
to choose lines.  Here's one possibility:

save - par3d(ignoreExtent=TRUE)
segments3d(c(3,3,4,4), c(min(y), max(y), min(y), max(y)), c(max(z), max(z), max(z), 
max(z)), col=red)
par3d(save)

Duncan Murdoch



  



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


Re: [R] [RGL] Need help to modify current plot

2010-05-18 Thread Megh Dal
Thanks Duncan for your reply. This could definitely be an answer of my query 
however I wanted something else. What I want is to draw 2 lines over the 
surface which pass through x=3,4
 
Any better idea?
 
Thanks,
--- On Tue, 5/18/10, Duncan Murdoch murdoch.dun...@gmail.com wrote:


From: Duncan Murdoch murdoch.dun...@gmail.com
Subject: Re: [R] [RGL] Need help to modify current plot
To: Megh Dal megh700...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, May 18, 2010, 3:51 PM


Megh Dal wrote:
 Dear folks, I have created a plot on RGL device :
  x = 1:6
 y = seq(-12, 5, by=1)
 z = matrix(0, length(y), length(x))
 z[13,3] = 1; z[13,4] = 1.011765
 surface3d(x, y, t(z), col=rainbow(1000))
 grid3d(c(x-, y-, z))
  Now I want to draw 2 lines along x=3  x=4, over the surface (with different 
colour). Could somebody help me how to draw that?
    

x=3 and x=4 specify planes, not lines, so you'll need to give more information 
to choose lines.  Here's one possibility:

save - par3d(ignoreExtent=TRUE)
segments3d(c(3,3,4,4), c(min(y), max(y), min(y), max(y)), c(max(z), max(z), 
max(z), max(z)), col=red)
par3d(save)

Duncan Murdoch



  
[[alternative HTML version deleted]]

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