我想制作一个带有条形图的图表,在链中放大以说明比例,如下所示:
我尝试使用 ggplot 和 ggforce(使用 facet_zoom),但我找不到怎么做。
以下是样本数据:
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))
这是我的ggplot图代码,但我没有缩放:
ggplot(data=d, aes(x=no_bar, y=nbr, fill=name)) +
geom_bar(stat="identity")