stan-dev / stan-dev/bayesplot

Unified wrapper functions for bayesplot families

Open
#433 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
R
Stars
442
Forks
93
Avg merge
3h 11m
Merged PRs (30d)
1

Description

Summary

Currently, each plot family in bayesplot exposes several closely related functions that share common inputs but differ in specific behaviors. For example, the error family within the PPC module includes:

  • ppc_error_hist()
  • ppc_error_hist_grouped()
  • ppc_error_scatter()
  • ppc_error_binned()
  • ...

Exposing all these individual functions in the documentation can make it difficult for users to navigate the package. To improve usability, I would propose providing a wrapper function for each family that consolidates these related functions into a single "general concept".

Proposed Change

Introduce a high-level wrapper for each family that dispatches to the underlying functions via a type argument. Below is an example of the intended structure (subject to further refinement):

ppc_error <- function(
    y,
    yrep,
    type = c("hist", "scatter", "scatter_avg", "scatter_avg_vs_x", "binned"),
    group = NULL,
    x = NULL,
    grouped = FALSE,
    ...
    )

We could implement a similar pattern for other families. This approach would result in a more organized API and more compact documentation pages.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing PPC entry points, including ppc_error_hist(), ppc_error_hist_grouped(), ppc_error_scatter(), and ppc_error_binned(), then compare how other bayesplot families are organized. Define the wrapper scope and type-dispatch behavior before consolidating the related functions and documentation; done means the agreed families have a coherent API without losing their existing behaviors.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.