Skip to content

Instantly share code, notes, and snippets.

@trialsolution
Created January 1, 2011 16:55
Show Gist options
  • Save trialsolution/761847 to your computer and use it in GitHub Desktop.
Save trialsolution/761847 to your computer and use it in GitHub Desktop.
drawing "polar roses" curves in polar coordinate system
require(ggplot2)
#data points
p <- data.frame(t=seq(-2*pi, 2*pi, 0.1))
#1.. drawing polar rose
c <- ggplot(p, aes(x=t, y=cos(3*t)))
c + geom_line() + coord_polar()
#2.. another one with sine
c <- ggplot(p, aes(x=t, y=2*sin(4*t)))
c + geom_line() + coord_polar()
#3.. Archimedean spiral
c <- ggplot(p, aes(x=t, y=2+4*t))
c + geom_line() + coord_polar()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment