在圆形图上显示平均箭头

时间:2014-04-04 10:00:23

标签: r plot

我用图书循环绘制我的物候数据(Fejeuncirculangle)。我获得了一个传统的图形,但我不可能在这个图中显示平均箭头。我不明白为什么,因为我可以轻松地为图中几个月的每个初始值,段和文本添加箭头。以下是我的代码。这是代码的问题吗?

x11()
plot.new()
library(circular)
na.exclude(tinitialcirculangle)
plot(tinitialcirculangle$Fejeuncirculangle,pch=20,col="blue",stack=TRUE,shrink=1.2,bins=52,ticks=TRUE)
Fejeuncirculangle<-circular(tinitialcirculangle$Fejeuncirculangle,type="angles",units="degrees",template="none",zero=circular(pi/2),rotation="clock",names="Feuiljeuncirculangle")
par(mai=c(0.5,0.75,0.5,0.75),cex.axis=1,cex.lab=1)
rose.diag(Fejeuncirculangle,bins=52,main="",col="darkolivegreen1",axes=FALSE)
points(Fejeuncirculangle,pch=20,col="darkolivegreen1",bg="black",next.points=+0.05)
arrows.circular(Fejeuncirculangle)
arrows.circular(mean(Fejeuncirculangle),angle=15,length=0.20,lwd=5,col="black")

# Month Segments - Ajouter les segments de séparation des mois
segments(0,0,1,0,col="black",lty=3,lwd=1)
segments(0,0,sqrt(3)/2,0.5,col="black",lty=3,lwd=1)
segments(0,0,0.5,sqrt(3)/2,col="black",lty=3,lwd=1)
segments(0,0,0,1,col="black",lty=3,lwd=1)
segments(0,0,-0.5,sqrt(3)/2,col="black",lty=3,lwd=1)
segments(0,0,-sqrt(3)/2,0.5,col="black",lty=3,lwd=1)
segments(0,0,-1,0,col="black",lty=3,lwd=1)
segments(0,0,-sqrt(3)/2,-0.5,col="black",lty=3,lwd=1)
segments(0,0,-0.5,-sqrt(3)/2,col="black",lty=3,lwd=1)
segments(0,0,0,-1,col="black",lty=3,lwd=1)
segments(0,0,0.5,-sqrt(3)/2,col="black",lty=3,lwd=1)
segments(0,0,sqrt(3)/2,-0.5,col="black",lty=3,lwd=1)

# Month texts - Ajouter les mois au graphique circulaire
text(0.2329,0.8693,"J",family="Calibri",font=1,cex=1)
text(0.6363,0.6363,"F",family="Calibri",font=1,cex=1)
text(0.8693,0.2329,"M",family="Calibri",font=1,cex=1)
text(0.8693,-0.2329,"A",family="Calibri",font=1,cex=1)
text(0.6363,-0.6363,"M",family="Calibri",font=1,cex=1)
text(0.2329,-0.8693,"J",family="Calibri",font=1,cex=1)
text(-0.2329,-0.8693,"J",family="Calibri",font=1,cex=1)
text(-0.6363,-0.6363,"A",family="Calibri",font=1,cex=1)
text(-0.8693,-0.2329,"S",family="Calibri",font=1,cex=1)
text(-0.8693,0.2329,"O",family="Calibri",font=1,cex=1)
text(-0.6363,0.6363,"N",family="Calibri",font=1,cex=1)
text(-0.2329,0.8693,"D",family="Calibri",font=1,cex=1)

1 个答案:

答案 0 :(得分:1)

尝试:

arrows.circular(mean(Fejeuncirculangle,na.rm=TRUE),angle=15,length=0.20,lwd=5,col="black")

如果这样做是因为你没有排除NA值,我怀疑你的第四行应该是:

tinitialcirculangle <- na.exclude(tinitialcirculangle)