Density singletons - #687
Merged
Merged
Conversation
- fancier version with warnings etc.
Singleton groups are dropped either way, but staying silent about it risks the missing panel (or violin, or ridge line) reading as "no data here" rather than "only one observation here". A survey of the standard datasets suggests this fires rarely -- only on small, unbalanced data like mtcars -- so the warning should be high-signal rather than noise. It is also emitted once per call, not on replay, so window resizes do not repeat it. Pass singletons = "drop" for the old quiet behaviour. Claude-Session: https://claude.ai/code/session_014YKk45eRcv5MkVuu9LkDeW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #300
As note in the issue thread, a simple fix for this was just filtering out the singletons preemptively:
... But I worry that the silent dropping might be misleading. So I ended up rolling a more sophisticated version in order to allow the possibility of emitting a nice user warning, which is controllable through the new type-level
singletonsargument. By default, the warning is on:Example with another density type (here: violin plots):
It's also possible to silence the warning with
singletons = "drop"). Our first example again:Created on 2026-08-21 with reprex v2.1.1