Skip to content

Instantly share code, notes, and snippets.

@coleoguy
Last active March 9, 2016 22:45
Show Gist options
  • Save coleoguy/b40191ca37cd4b71c076 to your computer and use it in GitHub Desktop.
Save coleoguy/b40191ca37cd4b71c076 to your computer and use it in GitHub Desktop.
plots a flower
flower <- function(x, y, colx="red", cex.x=1, cex.y=1, cex.f=1){
petalsx <- cex.x * c(0, 1, 0, -1)
petalsy <- cex.y * c(1, 0, -1, 0)
# this loop prints the petals
for(i in 1:4){
points(x + petalsx[i],
y + petalsy[i],
pch = 16, col = colx,
cex = cex.f)
}
# this prints the disk
points(x, y, pch = 16, col = "white", cex = cex.f * .65)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment