stan-dev / stan-dev/bayesplot

feature request: allow changing the labels of the legends

Open
#75 17 comments 1 reaction 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

This is an idea that came up in the discussion of #73

The point is to let users change the labels of the legend in bayesplot objects easily, possibly by setting them as arguments in the plot creation. This could for instance be helpful to plot the pp_check for two models and then label y_rep as model Aor model B, respectively.
I mainly used pp_check() until now but I guess this might be usable for other plotting possibilites as well.

@jgabry wrote in #73:

But another option would be to add additional arguments to all of the bayesplot plotting functions so that user's can specify the names to be used in the legend at the same time they create the plot. For example, it could look something like this maybe:

my_legend <- list(y = "emp. data", yrep = "model predict.") 
ppc_bars(y, yrep, ..., legend_labels = my_legend) 

That way the legends could be created with those labels instead of having to change them after the fact. I'd need to figure out the best way to implement that (it would vary depending on the plotting function) but that should be much easier to do.

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 discussion in #73 and the quoted ppc_bars() example. Compare how legend labels are produced in pp_check() and the other bayesplot plotting functions, then define a consistent legend_labels interface. Done means users can set labels such as “emp. data” and “model predict.” when creating plots.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.