Skip to content

Instantly share code, notes, and snippets.

@gkaramanis
Last active August 14, 2019 13:00
Show Gist options
  • Save gkaramanis/e899ae58ecc80be8e0ee7b9ecca3887b to your computer and use it in GitHub Desktop.
Save gkaramanis/e899ae58ecc80be8e0ee7b9ecca3887b to your computer and use it in GitHub Desktop.
Draw a leaf with closed b-spline shape in ggforce
library(ggforce)
library(ggplot2)
leaf <- data.frame(
x = c(1.6, 1.5, 1.8, 1.5, 1.6, 1.3),
y = c(2, 2, 1.5, 1, 1, 1.5)
)
ggplot(leaf, aes(x, y)) +
geom_polygon(fill = NA, colour = 'grey') +
geom_point(colour = 'red') +
geom_bspline_closed(alpha = 0.7) +
coord_fixed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment