[R] 6 regions around a point

Boris Steipe boris.steipe at utoronto.ca
Mon Dec 22 03:15:47 CET 2014

# A general approach to "lines" on a plot is provided by segments().
# However in this special case you can use abline(). 
# You have to take care though that your aspect ratio for the
# plot is exactly 1. Therefore you have to set the asp parameter.

p <- c(2,4)
plot(p[1], p[2], xlim=c(0,5), ylim=c(0,10), xlab="", ylab="", asp=1.0)
abline(h=p[2], lty=2)
abline(p[2] - (p[1]*tan(pi/3)),  tan(pi/3), lty=2)
abline(p[2] + (p[1]*tan(pi/3)), -tan(pi/3), lty=2)

# If you need to reproduce Fig. 2a more exactly:
#  - plot your frame a bit larger, don't draw axes
#  - draw the ablines
#  - draw two arrows to symbolize the coordinate axes

p <- c(2,4)
plot(p[1], p[2], xlim=c(-0.5,10.5), ylim=c(-0.5,10.5), , xlab="", ylab="", axes=n, asp=1.0)
abline(h=p[2], lty=2)
abline(p[2] - (p[1]*tan(pi/3)),  tan(pi/3), lty=2)
abline(p[2] + (p[1]*tan(pi/3)), -tan(pi/3), lty=2)
arrows(0, 0, 10, 0, length=0.1)
arrows(0, 0, 0, 10, length=0.1)


On Dec 21, 2014, at 2:25 PM, eliza botto <eliza_botto at hotmail.com> 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