[R] 6 regions around a point

Chel Hee Lee chl948 at mail.usask.ca
Mon Dec 22 05:46:21 CET 2014


You may try this:

 > get.coords.circle <- function(x0, y0, r, len, rot){
+ by <- seq(from=-pi, to=pi, length.out=len)
+ x <- r*cos(by+rot) + x0
+ y <- r*sin(by+rot) + y0
+ coords <- cbind(x,y)
+ coords[!duplicated(coords),]
+ }
 > xtms <- get.coords.circle(x0=2, y0=4, r=2, len=7, rot=0)
 > xtms1 <- get.coords.circle(x0=2, y0=4, r=1, len=7, rot=10)
 >
 > plot(xtms, type="n")
 > segments(x0=xtms[1:3,1], y0=xtms[1:3,2],
+ x=xtms[4:6,1], y=xtms[4:6,2])
 > text(xtms[c(4,5,6),], labels=paste("line1", 1:3, sep="_"))
 > text(xtms1, labels=paste("S", 1:6, sep="_"))
 > points(x=2, y=4, cex=3)
 >

Please see the output.  Is this what you are looking for?  I hope this 
helps.

Chel Hee Lee

On 12/21/2014 01:25 PM, eliza botto wrote:
> Dear UseRs,
> A point was plotted by the following command
>   plot(2,4,ylim=c(0,10),xlim=c(0,5))
> how to divide the space around the plotted point into six regions each of 60 degree as shown in the Figure 2a) in the following link http://infolab.usc.edu/csci599/Fall2007/papers/b-2.pdf.
> Thankyou very much in advance,
> Eliza.
>
>
>
>   		 	   		
> 	[[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
> 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