Skip to content

Instantly share code, notes, and snippets.

@gkaramanis
Created June 7, 2021 11:51
Show Gist options
  • Save gkaramanis/49a888c7ad89ee8dc1db88c67ac1ef65 to your computer and use it in GitHub Desktop.
Save gkaramanis/49a888c7ad89ee8dc1db88c67ac1ef65 to your computer and use it in GitHub Desktop.
library(ggforce)
library(dplyr)
l <- data.frame(a = c(100, 50, 10)) %>%
mutate(
r = sqrt(a/pi),
x0 = 0,
y0 = r
)
ggplot(l) +
geom_circle(aes(x0 = x0, y0 = y0, r = r)) +
geom_text(aes(x = 8, y = y0, label = a), hjust = 0) +
geom_segment(aes(x = x0 + r, y = y0, xend = 7.75, yend = y0), linetype = "dashed") +
coord_fixed() +
theme_void()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment