2014-01-20 144 views
1

我想绘制一个简单的极坐标图cos(ang)在R中使用polar.plot,但结果是以(-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") 
+0

您好,其真正!但中心将是0 y中的所得积必须是一个 “8” 字形:(0°:1,用于90°:0,为180°:-1,270°:0)我不明白为什么它有心脏形式。 –

回答

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

+0

好吧,我是问题,用radial.lim = c(0,1)和abs值,谢谢 –

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