-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Unexpected failure of density plot without any error or warning #3250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe the problematic code lives here: Lines 109 to 110 in 8359806
Non-unique data columns are silently dropped. We could issue a warning for non-unique missing columns. I just don't know how often such a warning might flag cases that are actually correct. |
@thomasp85 Since we're considering cleanup and breaking changes, I would bring up this issue once more, which is an eternal thorn in my side. It comes up every year when I teach ggplot2. I made a draft PR a long time ago that I could revive. Since all this code does is create a warning, it's not really going to break anything. But, there's the risk of false-positive warnings. The way to avoid false positives is to allow geoms to indicate that the dropped columns were dropped on purpose, and I believe 2-3 geoms in ggplot2 itself would require this modification to avoid spurious warnings. |
Yeah, let's revive it and have a look... maybe the best thing is simply to ship the warning and get feedback from users as to when it's a false positive so we can tune it after the fact |
Ok. Will try to get this done next week. |
…opped that shouldn't be. Fixes tidyverse#3250.
* Check for dropped aesthetics and issue a warning if aesthetics are dropped that shouldn't be. Fixes #3250. * update documentation
I encountered the following example when teaching density plots. If a discrete variable is encoded as numerical (e.g., 0/1), and that variable is mapped onto
fill
, the variable values get replaced withNA
and no fill is applied/no grouping is calculated. Importantly, this happens without any kind of error or warning message, so students get no indication of what they have done wrong, or that something went wrong at all.It's not immediately clear to me whether and how we can catch this situation, but it would be good if we could. Reprex follows.
Created on 2019-04-17 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: