YuLab-SMU / scatterpie

:art: scatter pie plot
https://cran.r-project.org/package=scatterpie
60 stars 15 forks source link

introduce donut_radius and bg_circle_radius parameters to control the layer of pie #46

Closed xiangpin closed 7 months ago

xiangpin commented 7 months ago
> library(ggplot2)
> d <- data.frame(x=rnorm(5), y=rnorm(5))
> d$A <- abs(rnorm(5, sd=1))
> d$B <- abs(rnorm(5, sd=2))
> d$C <- abs(rnorm(5, sd=3))
> d <- tidyr::gather(d, key="letters", value="value", -x:-y)
> p1 <- ggplot() +
        geom_scatterpie(
          mapping = aes(x=x, y=y), data=d, cols="letters",
          long_format=TRUE,
          donut_radius=.5
        ) +
        coord_fixed()
> p1

image

> p2 <- ggplot() +
        geom_scatterpie(
          mapping = aes(x=x, y=y), data=d, cols="letters",
          long_format=TRUE,
          donut_radius = .5,
          bg_circle_radius = 1.2
        ) +
        coord_fixed()
> p2

image