首页 文章

极坐标图坐标错误

提问于
浏览
1

我想使用polar.plot在R中绘制一个简单的cos(ang)极坐标图,但结果是一个中心在(-1)的图,结果图没有任何意义 . 例如,在90°中不是0 . 我怎么解决这个问题?

library(plotrix)
grados=seq(0,350,by=10)
radian=grados*pi/180
coseno=cos(radian)  
polar.plot(coseno,grados,rp.type="p")

2 回答

  • 2

    我不确定我是否完全理解你的问题,但你应该看看 radial.plot 的帮助,这解释了 polar.plot 中使用的很多参数 . 在下面的示例中,我添加了三个可以帮助您设置绘图定义的参数( startradial.limclockwise

    polar.plot(coseno,grados, rp.type="p", start=90, radial.lim=c(-1,1.5), clockwise=TRUE)
    

    enter image description here

  • 2

    解;

    library(plotrix)
    grad=seq(0,359,by=1)
    rad=grad*pi/180  # degrees to radian
    func=(cos(rad))
    func=abs(func)   # negative numbers not plot
    polar.plot(func,grad,rp.type="p",radial.lim=c(0,1),
                lwd=2,line.col=4,main="Polar Plot")
    

    enter image description here

相关问题