In my code, read the data to draw the polar plot image. But the "0 /360" is in the top. How can I rotate it to the right hand by 90 degrees?
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()
The full procedure and resulting graphic is described here: http://keveting.blogspot.tw/2012/08/r-ggplot2-code.html
The documentation for coord_polar
:
start : offset from 12 o'clock in radians direction: 1, clockwise ; -1, anticlockwise
so I tried
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()
But it still doesn't rotate the plot the way I want it to the right by 90 degrees.
I think this is what you're looking for:
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()
As the link to the coord_polar
documentation says, the start
is the offset in radians (not degrees) and you want to rotate it clockwise (so direction=1
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With