Skip to content

Instantly share code, notes, and snippets.

@matt-dray
Created June 2, 2022 12:18
Show Gist options
  • Save matt-dray/3ce9578e19c483ea7b724e263bd88024 to your computer and use it in GitHub Desktop.
Save matt-dray/3ce9578e19c483ea7b724e263bd88024 to your computer and use it in GitHub Desktop.
Testing out R's new plotting symbols
library(ggplot2)
library(ggsvg)
td_1_url <- "https://upload.wikimedia.org/wikipedia/commons/d/d0/Trommeltrocknen.svg"
td_2_url <- "https://upload.wikimedia.org/wikipedia/commons/0/0c/Trommeltrocknen_1.svg"
td_3_url <- "https://upload.wikimedia.org/wikipedia/commons/1/14/Trommeltrocknen_2.svg"
td_4_url <- "https://upload.wikimedia.org/wikipedia/commons/3/38/Nicht_trommeltrocknen.svg"
td_1 <- paste(readLines(td_1_url), collapse = "\n")
td_2 <- paste(readLines(td_2_url), collapse = "\n")
td_3 <- paste(readLines(td_3_url), collapse = "\n")
td_4 <- paste(readLines(td_4_url), collapse = "\n")
mtcars_1 <- mtcars[1:5, ]
mtcars_2 <- mtcars[6:10, ]
mtcars_3 <- mtcars[11:15, ]
mtcars_4 <- mtcars[16:20, ]
ggplot() +
geom_point_svg(aes(mtcars_1$mpg, mtcars_1$wt), svg = td_1) +
geom_point_svg(aes(mtcars_2$mpg, mtcars_2$wt), svg = td_2) +
geom_point_svg(aes(mtcars_3$mpg, mtcars_3$wt), svg = td_3) +
geom_point_svg(aes(mtcars_4$mpg, mtcars_4$wt), svg = td_4) +
labs(x = "mpg", y = "wt") +
theme_bw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment