Creating a half-donut, or parliamentary seating, chart

前端 未结 3 533
醉梦人生
醉梦人生 2021-02-06 07:38

I\'d like to create a chart displaying the size of the seats to a parliament, such as the one below, in ggplot2. My main problem is, essentially, how do I turn a donut chart to

3条回答
  •  鱼传尺愫
    2021-02-06 08:02

    FWIW, one might also check out the nice ggforce package:

    library(tidyverse)
    library(ggforce)
    library(scales)
    df %>%
      mutate_at(vars(starts_with("y")), rescale, to=pi*c(-.5,.5), from=0:1) %>%
      ggplot + 
      geom_arc_bar(aes(x0 = 0, y0 = 0, r0 = .5, r = 1, start = ymin, end = ymax, fill=Party)) + 
      coord_fixed() 
    

提交回复
热议问题