insightsengineering / insightsengineering/ggplot2.utils

Try simple extension of `facet_grid` to remove specific levels of factor from plot

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
9
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Motivation: If we want to compare the BEP vs. All population using the `margin = TRUE` in `facet_grid()` works. However, it also gives us the non-BEP facets. We might not need/want to show this.

Idea: We could inherit from `facet_grid` and add additional argument `droplevels` which could be a list with one element per factor used, which can specify which levels not to have in the final plot. See https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.html

Provenance:
```
Creator: Sabanes Bove, Daniel {MDBR~Basel}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the facet_grid behavior and the ggplot2 extending vignette linked in the issue. Define how an inherited facet_grid extension would accept a droplevels list for each factor and verify that selected levels are absent while the remaining facets and margin behavior are preserved.

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.