[R] Customise a symbol in a scatterplot with for loop

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Mar 23 22:37:42 CET 2014


Please read the Posting Guide... this is not a homework help forum. Please use the assistance provided by your educational institution for homework.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On March 23, 2014 1:00:12 PM PDT, amcc <martinangelamccourt at eircom.net> wrote:
>Hi, 
>I have the code below to generate a pentagon in R.  I have generated a
>regular scatterplot and need to draw a scatterplot with a pentagon at
>each
>(x,y) position, for the radius use r x 0.3.  The hint I've been given
>is
>that I do not need to store the polygons in a list, simply construct
>and
>draw the polygons within a for loop.  Four hours have gone by and I'm
>no
>closer, so any help would be appreciated.  My original scatterplot code
>is 
>
>plot(Sepal.Width~Sepal.Length, data=iriss)
>
>mk_pent<-
> function(x,y,r){
>  angle<-(0:4)*360/5+90
>  angle<-angle*pi/180
>  xs<-r*cos(angle)+x
>  ys<-r*sin(angle)+y
> cbind(x=xs,y=ys)}
>
>Thanks
>A
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Customise-a-symbol-in-a-scatterplot-with-for-loop-tp4687386.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>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.




More information about the R-help mailing list