ngon | R Documentation |
Draws a regular polygon with n sides, such as a triangle (n=3) or hexagon (n=6).
ngon(x = 0, y = 0, s = 1, n = 6, angle = 0, fix.aspect = TRUE, ...)
x |
vector of x-coordinates specifying the centres of the n-gons. |
y |
vector of y-coordinates specifying the centres of the n-gons. |
s |
side lengths; either a single number or a vector of the same length as |
n |
number of sides of the regular n-gons; either a single number or a vector of the same length as |
angle |
rotation angle in radians; either a single number or a vector of the same length as |
fix.aspect |
logical flag. If TRUE (default), the aspect ratio of the n-gon on the screen is forced to be unity, even if the this makes it irregular in the coordinates of the plot. If FALSE, the n-gon is regular in plot coordinates, which makes it distorted in screen coordinates if the aspect ratio is not one and/or if logarithmic coordinates are used. |
... |
additional arguments used by |
None.
Danail Obreschkow
## Plot random points on the unit sphere in Mollweide projection
# hexagon at the center of a plot
nplot(bty='o', asp=0.5)
ngon(x=0.5, y=0.5, s=0.1, n=6, fix.aspect=FALSE)
ngon(x=0.5, y=0.5, s=0.1, n=6, border='red')
plot(NA,xlim=c(1,1e3),ylim=c(1,1e5),log='xy')
ngon(x=10^runif(10,0,3), y=10^runif(10,0,5), s=1, n=6, border='red',lwd=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.