How to specify group-specific distribution parameters in geom_qq


#1

Hi,

The dparams argument of geom_qq allows to define the parameter of the distribution function using numeric values. However, when one uses facetting or grouping, these values may be different. Is there a way to set group/facet specific values?

require(ggplot2)
#> Loading required package: ggplot2

set.seed(1234)

df <- data.frame(
  panel = factor(rep(1:2, each = 100)),
  grp = factor(rep(c(2, 3, 1, 4), each = 50)),
  x = c(
    rlnorm(50, 2, 0.5),
    rlnorm(50, 3, 1.5),
    rlnorm(50, 1, 0.1),
    rlnorm(50, 4, 1)
  ),
  mean = rep(c(2, 3, 1, 4, each = 50)),
  sd = rep(c(0.5, 1.5, 0.1, 1), each = 50)
)

ggplot(data = df, aes(sample = x, colour = grp)) +
  geom_qq(distribution = qlnorm, dparams = list(mean = 1, sd = 0.5)) +
  facet_wrap('panel', scales = 'free')