Skip to content

Instantly share code, notes, and snippets.

@jmcastagnetto
Created July 11, 2019 14:45
Show Gist options
  • Save jmcastagnetto/13ff89806d268fd05154c77c18656783 to your computer and use it in GitHub Desktop.
Save jmcastagnetto/13ff89806d268fd05154c77c18656783 to your computer and use it in GitHub Desktop.
R code to draw the flag of Peru
library(tidyverse)
df <- data.frame(
x1 = 0:2, x2 = 1:3,
y1 = rep(0, 3), y2 = rep(2, 3),
color = c("r", "w", "r"))
ggplot(df) +
geom_rect(aes(xmin = x1, xmax = x2,
ymin = y1, ymax = y2,
fill = color)
) +
scale_fill_manual(
values = c("red", "white", "red"),
guide = FALSE
) +
labs(title ="Julio: mes patrio en el Perú",
subtitle = "¡Feliz 28 de Julio!",
caption = "Jesús M. Castagnetto (@jmcastagnetto)") +
theme_void() +
theme(
plot.title = element_text(
hjust = 0.5,
family = "Latin Modern Roman Caps",
size = 24
),
plot.subtitle = element_text(
hjust = 0.5,
family = "Latin Modern Roman Caps",
size = 20
)
)
ggsave("peru-bandera-r.png", width = 9, height = 6)
@jmcastagnetto
Copy link
Author

peru-bandera-r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment