# [R] Writing my 3D plot function

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon Jun 26 01:46:22 CEST 2017

```Please look at what I see in your code below (run-on code mush) to understand part of why it is important for you to send your email as plain text as the Posting Guide indicates.  You might find [1] helpful.

[1] https://wiki.openstack.org/wiki/MailingListEtiquette
--
Sent from my phone. Please excuse my brevity.

On June 25, 2017 2:42:26 PM EDT, Alaios via R-help <r-help at r-project.org> wrote:
>Hi all,I had a question last week on asking for a function that will
>help me draw three different circles on x,y,z axis based on polar
>coordinates (Each X,Y,Z circle are coming from three independent
>measurements of 1-360 polar coordinates). It turned out that there  is
>no such function in R and thus I am trying to write my own piece of
>code that hopefully I will be able to share. I have spent some time to
>write some code based on the rgl library (Still not 100% sure that this
>was the best option).
>My input are three polar circles X,Y,Z with a good example being the
>image
>belowhttps://www.mathworks.com/help/examples/antenna/win64/xxpolarpattern_helix.png
>
>So for X axis my input is a 2D matrix [360,2] including a single
>measurement per each polar coordinate. The first thing I tried was to
>turn my polar coordinates to cartesian ones by writing two simple
>functions. This works so far and I was able to print three simple
>circles on 3d spaceb but the problem now are the legends I need to put
>that remain on cartesian coordinates. As you can see from the code
>below all circles should have radius 1 (in terms of simplicity) but
>unfortunately I have the cartesian coordinates legends that do not help
>on reading my Figure. You can help me by executing the code below
>
>require("rgls")
>turnPolarToX<-function(Amplitude,Coordinate){  return
>turnPolarToY<-function(Amplitude,Coordinate){  return
># Putting the first circle on 3d space. Circle of radius
>1X1<-turnPolarToX(1,1:360)Y1<-turnPolarToY(1,1:360)Z1<-rep(0,360)
># Putting the second circle on 3d space. Circle of radius
>1X2<-turnPolarToX(1,1:360)Y2<-rep(0,360)Z2<-turnPolarToY(1,1:360)
># Putting the third circle on 3d space. Circle of radius
>1X3<-rep(0,360)Y3<-turnPolarToX(1,1:360)Z3<-turnPolarToY(1,1:360)
>Would it be also possible to include an jpeg image file on a rgls plot?
>Thanks a lotRegardsAlex
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help