Skip to content

Instantly share code, notes, and snippets.

@oliviergimenez
Created October 20, 2020 21:17
Show Gist options
  • Save oliviergimenez/0adf188ca878499b6e186b8b1cbdc62a to your computer and use it in GitHub Desktop.
Save oliviergimenez/0adf188ca878499b6e186b8b1cbdc62a to your computer and use it in GitHub Desktop.
Plot a red heart
# https://twitter.com/GeoffZahn/status/1318653420027273216?s=20
library(tidyverse)
data_frame(t=seq(-pi, 0, .001),
x1=16*(sin(t))^2,
x2=-x1,
y=13*cos(t) -5 * cos(2*t) -2*cos(3*t) - cos(4*t)) %>%
gather(side, x, x1, x2) %>%
ggplot(aes(x,y)) +
geom_polygon(fill="red") +
coord_fixed() +
theme_minimal()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment