Re: [R] how to draw manifold?

2010-11-21 Thread baptiste auguie
Hi,

I'm joining in with a question -- is it possible to vary the color of
the lines along z? The 'colors' argument doesn't seem to allow a
vector in this situation.

Thanks,

baptiste



On 21 November 2010 21:02, Carl Witthoft c...@witthoft.com wrote:
 Thanks, Dennis.   Here's an enhanced version:

  z - seq(-10, 10, 0.1)
  zm-cbind(z,z,z,z,z,z,z,z,z,z)

 ym-matrix(nr=201,nc=10)
 for (i in seq(1,201)) {
        for (j in seq(1,10)) ym[i,j]-j/10*sin(zm[i,1])}

 xm-matrix(nr=201,nc=10)
 for (i in seq(1,201)) {
        for (j in seq(1,10)) xm[i,j]-j/10*cos(zm[i,1])}


 scatterplot3d(as.vector(t(xm)), as.vector(t(ym)), as.vector(t(zm)), main =
 'Helix', pch = .,type='l')


 From there I can draw a few helical lines by modifying your original code
 (for different radii), and end up with a pretty decent mesh surface.

 Carl


 On 11/20/10 12:03 PM, Dennis Murphy wrote:

 Hi:

 Here's an example stolen out of the scatterplot3d package vignette (p. 9):

 library(scatterplot3d)
 z- seq(-10, 10, 0.01)
 x- cos(z)
 y- sin(z)
 scatterplot3d(x, y, z, highlight.3d = TRUE, col.axis = 'blue',
               col.grid = 'lightblue', main = 'Helix', pch = 20)

 HTH,
 Dennis

 On Sat, Nov 20, 2010 at 8:29 AM, Carl Witthoftc...@witthoft.com  wrote:

 Hi,
 I need some help either in how to configure variables for wireframe(), or
 some suggestions as to other graphics commands to use for plotting a 2-D
 manifold in 3-D space.

 Here is an example I tried (in the hopes that it would plot a helical
 line)
 :

 xsp-matrix(c(cos(seq(0,80)/5)),9,9)
 ysp-matrix(c(sin(seq(0,80)/5)),9,9)
 zsp-matrix(c((seq(0,80)/20)),9,9)
 wireframe(zsp~xsp*ysp)

 The resulting plot looks vaguely like a helix, but not right.  And if I
 change my variables' dimensions to c(3,27) it looks better, but if the
 dims are c(1,81), nothing gets plotted.

 So: is there a way to control which points are connected by lines in
 wireframe()?  Or is there a more appropriate way to provide a plotting
 program with sets of coordinates in 3-space?

 My primary goal is to be able to plot surfaces, not just a line as in my
 sample code.  For example, I might expand the data above to represent
 points
 on a 'ribbon' helix.

 Thanks for yr. help -- feel free to point me to help files for existing
 packages or plotting routines.

 Carl

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



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


__
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] how to draw manifold?

2010-11-21 Thread David Winsemius


On Nov 21, 2010, at 3:42 PM, baptiste auguie wrote:


Hi,

I'm joining in with a question -- is it possible to vary the color of
the lines along z? The 'colors' argument doesn't seem to allow a
vector in this situation.


This section of the code (which appears fairly close to the beginning,  
makes me think that the color argument is passed as part of the x  
argument.


if (!is.null(d - dim(x))  (length(d) == 2)  (d[2] =
4))
color - x[, 4]
else if (is.list(x)  !is.null(x$color))
color - x$color

-

Either as the 4th column of a matrix or as a color-list-element.

David.


Thanks,

baptiste



On 21 November 2010 21:02, Carl Witthoft c...@witthoft.com wrote:

Thanks, Dennis.   Here's an enhanced version:

 z - seq(-10, 10, 0.1)
 zm-cbind(z,z,z,z,z,z,z,z,z,z)

ym-matrix(nr=201,nc=10)
for (i in seq(1,201)) {
   for (j in seq(1,10)) ym[i,j]-j/10*sin(zm[i,1])}

xm-matrix(nr=201,nc=10)
for (i in seq(1,201)) {
   for (j in seq(1,10)) xm[i,j]-j/10*cos(zm[i,1])}


scatterplot3d(as.vector(t(xm)), as.vector(t(ym)), as.vector(t(zm)),  
main =

'Helix', pch = .,type='l')


From there I can draw a few helical lines by modifying your  
original code
(for different radii), and end up with a pretty decent mesh  
surface.


Carl


On 11/20/10 12:03 PM, Dennis Murphy wrote:


Hi:

Here's an example stolen out of the scatterplot3d package vignette  
(p. 9):


library(scatterplot3d)
z- seq(-10, 10, 0.01)
x- cos(z)
y- sin(z)
scatterplot3d(x, y, z, highlight.3d = TRUE, col.axis = 'blue',
  col.grid = 'lightblue', main = 'Helix', pch = 20)

HTH,
Dennis

On Sat, Nov 20, 2010 at 8:29 AM, Carl Witthoftc...@witthoft.com   
wrote:



Hi,
I need some help either in how to configure variables for  
wireframe(), or
some suggestions as to other graphics commands to use for  
plotting a 2-D

manifold in 3-D space.

Here is an example I tried (in the hopes that it would plot a  
helical

line)
:

xsp-matrix(c(cos(seq(0,80)/5)),9,9)
ysp-matrix(c(sin(seq(0,80)/5)),9,9)
zsp-matrix(c((seq(0,80)/20)),9,9)
wireframe(zsp~xsp*ysp)

The resulting plot looks vaguely like a helix, but not right.   
And if I
change my variables' dimensions to c(3,27) it looks better, but  
if the

dims are c(1,81), nothing gets plotted.

So: is there a way to control which points are connected by lines  
in
wireframe()?  Or is there a more appropriate way to provide a  
plotting

program with sets of coordinates in 3-space?

My primary goal is to be able to plot surfaces, not just a line  
as in my
sample code.  For example, I might expand the data above to  
represent

points
on a 'ribbon' helix.

Thanks for yr. help -- feel free to point me to help files for  
existing

packages or plotting routines.

Carl

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





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



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


David Winsemius, MD
West Hartford, CT

__
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] how to draw manifold?

2010-11-21 Thread Carl Witthoft

Thanks, Dennis.   Here's an enhanced version:

 z - seq(-10, 10, 0.1)
  zm-cbind(z,z,z,z,z,z,z,z,z,z)

ym-matrix(nr=201,nc=10)
for (i in seq(1,201)) {
for (j in seq(1,10)) ym[i,j]-j/10*sin(zm[i,1])}

xm-matrix(nr=201,nc=10)
for (i in seq(1,201)) {
for (j in seq(1,10)) xm[i,j]-j/10*cos(zm[i,1])}


scatterplot3d(as.vector(t(xm)), as.vector(t(ym)), as.vector(t(zm)), main 
= 'Helix', pch = .,type='l')



From there I can draw a few helical lines by modifying your original 
code (for different radii), and end up with a pretty decent mesh surface.


Carl


On 11/20/10 12:03 PM, Dennis Murphy wrote:

Hi:

Here's an example stolen out of the scatterplot3d package vignette (p. 9):

library(scatterplot3d)
z- seq(-10, 10, 0.01)
x- cos(z)
y- sin(z)
scatterplot3d(x, y, z, highlight.3d = TRUE, col.axis = 'blue',
   col.grid = 'lightblue', main = 'Helix', pch = 20)

HTH,
Dennis

On Sat, Nov 20, 2010 at 8:29 AM, Carl Witthoftc...@witthoft.com  wrote:


Hi,
I need some help either in how to configure variables for wireframe(), or
some suggestions as to other graphics commands to use for plotting a 2-D
manifold in 3-D space.

Here is an example I tried (in the hopes that it would plot a helical line)
:

xsp-matrix(c(cos(seq(0,80)/5)),9,9)
ysp-matrix(c(sin(seq(0,80)/5)),9,9)
zsp-matrix(c((seq(0,80)/20)),9,9)
wireframe(zsp~xsp*ysp)

The resulting plot looks vaguely like a helix, but not right.  And if I
change my variables' dimensions to c(3,27) it looks better, but if the
dims are c(1,81), nothing gets plotted.

So: is there a way to control which points are connected by lines in
wireframe()?  Or is there a more appropriate way to provide a plotting
program with sets of coordinates in 3-space?

My primary goal is to be able to plot surfaces, not just a line as in my
sample code.  For example, I might expand the data above to represent points
on a 'ribbon' helix.

Thanks for yr. help -- feel free to point me to help files for existing
packages or plotting routines.

Carl

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





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


[R] how to draw manifold?

2010-11-20 Thread Carl Witthoft

Hi,
I need some help either in how to configure variables for wireframe(), 
or some suggestions as to other graphics commands to use for plotting a 
2-D manifold in 3-D space.


Here is an example I tried (in the hopes that it would plot a helical 
line) :


xsp-matrix(c(cos(seq(0,80)/5)),9,9)
ysp-matrix(c(sin(seq(0,80)/5)),9,9)
zsp-matrix(c((seq(0,80)/20)),9,9)
wireframe(zsp~xsp*ysp)

The resulting plot looks vaguely like a helix, but not right.  And if I 
change my variables' dimensions to c(3,27) it looks better, but if the 
dims are c(1,81), nothing gets plotted.


So: is there a way to control which points are connected by lines in 
wireframe()?  Or is there a more appropriate way to provide a plotting 
program with sets of coordinates in 3-space?


My primary goal is to be able to plot surfaces, not just a line as in my 
sample code.  For example, I might expand the data above to represent 
points on a 'ribbon' helix.


Thanks for yr. help -- feel free to point me to help files for existing 
packages or plotting routines.


Carl

__
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] how to draw manifold?

2010-11-20 Thread Dennis Murphy
Hi:

Here's an example stolen out of the scatterplot3d package vignette (p. 9):

library(scatterplot3d)
z - seq(-10, 10, 0.01)
x - cos(z)
y - sin(z)
scatterplot3d(x, y, z, highlight.3d = TRUE, col.axis = 'blue',
  col.grid = 'lightblue', main = 'Helix', pch = 20)

HTH,
Dennis

On Sat, Nov 20, 2010 at 8:29 AM, Carl Witthoft c...@witthoft.com wrote:

 Hi,
 I need some help either in how to configure variables for wireframe(), or
 some suggestions as to other graphics commands to use for plotting a 2-D
 manifold in 3-D space.

 Here is an example I tried (in the hopes that it would plot a helical line)
 :

 xsp-matrix(c(cos(seq(0,80)/5)),9,9)
 ysp-matrix(c(sin(seq(0,80)/5)),9,9)
 zsp-matrix(c((seq(0,80)/20)),9,9)
 wireframe(zsp~xsp*ysp)

 The resulting plot looks vaguely like a helix, but not right.  And if I
 change my variables' dimensions to c(3,27) it looks better, but if the
 dims are c(1,81), nothing gets plotted.

 So: is there a way to control which points are connected by lines in
 wireframe()?  Or is there a more appropriate way to provide a plotting
 program with sets of coordinates in 3-space?

 My primary goal is to be able to plot surfaces, not just a line as in my
 sample code.  For example, I might expand the data above to represent points
 on a 'ribbon' helix.

 Thanks for yr. help -- feel free to point me to help files for existing
 packages or plotting routines.

 Carl

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


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