我可以用GGPLOT2轻松绘制图形如下图所示:GGPLOT2极坐标图箭头
其实,对于我的数据,它是象下面这样:
degree value 1 120 0.50 2 30 0.20 3 -120 0.20 4 60 0.50 5 150 0.40 6 -90 0.14 7 -60 0.50 8 0 0.60
第一列是度数(从-180到180或从0到360),第二列是相应的值。所以我想借鉴(0,0)的图表点和每一个数据点的箭头,但有一个圆形的坐标如下:
2 http://www.matrixlab-examples.com/image-files/polar_plots_1.gif
我尝试使用如下代码:
base <- ggplot(polar, aes(x=degree, y=value))
p <- base + coord_polar()
p <- p + geom_segment(aes(x=0, y=0, xend=degree, yend=value), arrow=arrow(length=unit(0.3,"cm")))
print(p)
它产生了极坐标图,但我没有从(0,0)到我的数据点得到直线箭头。
我也尝试使用plotrix软件包来绘制此图。它的工作原理如下图所示:
3 http://rgm2.lab.nig.ac.jp/RGM_results/plotrix:polar.plot/polar.plot_001_med.png
我不能在这个图中导入箭头。
如何使用plotrix软件包添加箭头,或者如何使用ggplot2绘制它? (从dput
)
看看这篇文章:http://stackoverflow.com/questions/42276773/ggplot-connecting-points-in-polar-coordinates-with-a-straight-line – Roland