Aligning four 'nested' circles along their bottom edges in R

I am trying to create a visual that nests four circles as so:

nestedcircles

The size of the circle depends on a ratio/numeric value relative to the largest circle.

I found this post which seems to provide a solution for two aligned circles: Bubble Chart with bubbles aligned along their bottom edges

However, I am a complete newbie to R and not sure how to proceed to achieve the desired four aligned circles.

Sample input data:

d <- read.table(text = "circle:x Circle1:340000 Circle2:5000 Circle3:1100 Circle4:340", header = TRUE, sep = ":") 

Desired Output of four aligned circles based on input numbers:

nestedcircles

4

1 Answer

Convert area to radius, then use ggforce to draw circles:

library(ggforce) #convert area to R d$r <- sqrt(d$x / pi) d$x0 <- max(d$r) / 2 d$y0 <- d$r ggplot(d, aes(x0 = x0, y0 = y0, r = r, fill = circle)) + geom_circle() + theme_void() 

enter image description here

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like