[R] Customise a symbol in a scatterplot with for loop
amcc
martinangelamccourt at eircom.net
Sun Mar 23 21:00:12 CET 2014
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.
More information about the R-help
mailing list