[R] Plotting parametrized curves (2D or 3D)

David Winsemius dwinsemius at comcast.net
Thu Jul 14 00:44:02 CEST 2011


On Jul 13, 2011, at 6:08 PM, amenning wrote:

> The curve() function plots an expression in x over an interval  
> [from,to]. I
> am looking for a function that would allow me to plot a parametrized  
> curve
> t -> x(t) where x is a vector in 2 or 3 dimensions.
>
>  For example (cos(t), sin(t)) (a2D  circle) or (cos(t), sin(t), t)  
> (a 3D
> helix). It seems that neither curve(), plot(), nor persp() are  
> helpful for
> that particular problem. I bet I?m not the first one missing this
> functionality and it probably already exists somewhere. Thanks for any
> hints.

Well, I don't know if anyone has done a paracurve, but surely this  
delivers an expected 2D result with plot():

plot(sin(seq(0, 2*pi, by=0.01)), cos(seq(0, 2*pi, by=0.01)))

I have also see the scatterplot developers demonstrate helices in 3D:
(from the Ligges article at citeseer ... and probably ,many other  
sites):

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.150.4841&rep=rep1&type=pdf

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)

Yep .....  still works.

>
>  Toni Menninger
>  Department of Geosciences
>  University of Arkansas
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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



More information about the R-help mailing list