YuLab-SMU / scatterpie

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

Cannot plot categorical data #33

Open wcerfgba opened 2 years ago

wcerfgba commented 2 years ago

Hello,

I am trying to use scatterpie with categorical x and y variables but I get the following error when I try:

Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] : 
  non-numeric argument to binary operator

Here is a minimal reproducible example:

data <- data.frame(
  x = sample(c('a', 'b', 'c'), 10, replace = TRUE),
  y = sample(c('t', 'u', 'v'), 10, replace = TRUE),
  m = rnorm(10),
  n = rnorm(10)
)
ggplot() +
  geom_scatterpie(
    aes(
      x = x,
      y = y
    ),
    data = data,
    cols = c(m, n)
  )

I have seen two other issues about this (#2 and #13) but I don't see any example in the vignette: all examples in the vignette are continuous lat and long x/y.

Thanks!