我在R中找到了plotrix包但是还不知道如何在R中做这个简单的圆.基本上,我怎样才能做半径为1和0的极坐标:360度角度,产生一个圆?
例
$$ r\COS \左(\压裂{2\PI} {3} \左(\压裂{3\THETA} {2\PI} - \左\ lfloor \压裂{3\THETA} {2\PI}\right\rfloor\right) - \frac {\ pi} {3}\right)= 1 $$
也许相关
您可以轻松地在ggplot2中获取极坐标图.
library(ggplot2)
cxc <- ggplot(mtcars, aes(x = factor(cyl))) +
geom_bar(width = 1, colour = "black")
cxc <- cxc + coord_polar()
print(cxc)
Run Code Online (Sandbox Code Playgroud)

您还可以使用几何体创建圆
circle <- function(x, y, rad = 1, nvert = 500, ...){
rads <- seq(0,2*pi,length.out = nvert)
xcoords <- cos(rads) * rad + x
ycoords <- sin(rads) * rad + y
polygon(xcoords, ycoords, ...)
}
# asp = 1 due to Hans' comment below- wouldn't let me leave a comment just saying 'thanks'
plot(-5:5, type="n", xlim = c(-5,5), ylim = c(-5,5), asp = 1)
circle(0,0,4)
circle(-1.5,1.5,.5)
circle(1.5,1.5,.5)
circle(0,0,1)
segments(-2,-2,2,-2)
Run Code Online (Sandbox Code Playgroud)