0

I would like to make a graph with bar plot zooming in chains to illustrate proportions, like this: enter image description here

I tried with ggplot and ggforce (with facet_zoom) but I couldn't find how to do it.

Here are the sample data:

structure(list(name = c("other", "Housing owner occupied", "Housing rented", 
"Housing owner living at home", "Housing owner living elsewhere", 
"Housing owner living in Brussels", "Housing owner living outside Brussels"
), nbr = c(10000L, 170000L, 270000L, 50000L, 220000L, 110000L, 
110000L), no_bar = c(1L, 1L, 1L, 2L, 2L, 3L, 3L)), class = "data.frame", row.names = c(NA, 
-7L))

Here is my code for ggplot graph but I don't get to have the zoom:

ggplot(data=d, aes(x=no_bar, y=nbr, fill=name)) +
  geom_bar(stat="identity")
  • 1
    What exactly did your `facet_zoom` code look like? How exactly did it not do what you want? – MrFlick Jul 30 '21 at 17:14
  • I updated my question with what I came up with, I don't know how to use facet zoom. – Hugo Périlleux Sanchez Jul 30 '21 at 17:34
  • 3
    Seems related: [Draw lines between different elements in a stacked bar plot](https://stackoverflow.com/questions/41648462/draw-lines-between-different-elements-in-a-stacked-bar-plot) – Henrik Jul 30 '21 at 17:44

0 Answers0