在我的代码中,读取数据以绘制极坐标图.但"0/360"位居榜首.如何将它旋转到右手90度?
ggplot(polar, aes(x=angle, y=distance )) + coord_polar(start=0) + geom_point() +
scale_x_continuous(breaks=seq(0, 360, by=30), expand=c(0,0), lim=c(0, 360))+
scale_area()
Run Code Online (Sandbox Code Playgroud)
完整的过程和结果图形在此处描述:http: //keveting.blogspot.tw/2012/08/r-ggplot2-code.html
文档coord_polar:
开始:从弧度方向的12点偏移:1,顺时针; -1,逆时针
所以我试过了
ggplot(polar, aes(x=angle, y=distance)) +
coord_polar(***start = 90, direction = -1***) +
geom_point() + scale_x_continuous(breaks=seq(0, 360, by=30), expand=c(0,0),
lim=c(0, 360)) + scale_area()
Run Code Online (Sandbox Code Playgroud)
但它仍然没有按照我想要的方式向右旋转90度.
smi*_*lig 12
我想这就是你要找的东西:
ggplot(polar, aes(x=angle, y=distance)) +
coord_polar(start = 1.57, direction=1) + geom_point() +
scale_x_continuous(breaks=seq(0, 360, by=30), expand=c(0,0), lim=c(0, 360)) +
scale_area()
Run Code Online (Sandbox Code Playgroud)

正如coord_polar文档链接所示,start是弧度的偏移量(不是度数),你想顺时针旋转它(所以direction=1).
| 归档时间: |
|
| 查看次数: |
1781 次 |
| 最近记录: |