bayesplot icon indicating copy to clipboard operation
bayesplot copied to clipboard

unify argument defaults for density-like plots

Open tjmahr opened this issue 6 years ago • 1 comments

This is something I noticed while reviewing ppc_dens_overlay(). The density defaults were hard-coded for ppc_dens_overlay() but not for these similar functions.

mcmc_areas <- function(..., 
                       bw = NULL,
                       adjust = NULL,
                       kernel = NULL,
                       n_dens = NULL) {}

mcmc_areas_data <- function(...,
                            bw = NULL,
                            adjust = NULL,
                            kernel = NULL,
                            n_dens = NULL) {}

mcmc_areas_ridges <- function(...,
                             bw = NULL, 
                             adjust = NULL, 
                             kernel = NULL,
                             n_dens = NULL){}

mcmc_areas_ridges_data <- function(...,
                                   bw = NULL, 
                                   adjust = NULL, 
                                   kernel = NULL,
                                   n_dens = NULL) {}

# this function does all the density calculations for the four above functions
compute_interval_density <- function(x, interval_width = 1, n_dens = 1024,
                                     bw = NULL, adjust = NULL, kernel = NULL) {
  n_dens <- n_dens %||% 1024
  ...
}

We should make this more consistent and update the @template args-density-controls boilerplate file.

tjmahr avatar Dec 05 '17 16:12 tjmahr

Thought I already responded to this but I guess not. Agreed that we should unify this.

jgabry avatar Dec 19 '17 18:12 jgabry