-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
default_aes not used in compute_*() methods #3860
Comments
Digging a bit deeper. It appears that it is also not possible to set aesthetics from a stat in the same way as it is possible to set aesthetics in a geom... All this seems to indicate a conscious decision to let aesthetics in stat behave almost, but no quite, like the aesthetics in geom, but the reason eludes me |
If there's an underlying reason I have long since forgotten it. Maybe it's to avoid some sort of precedence clash between stats and geoms? |
I'll try to see if this is fixable without any nasty side-effects... It completely caught me off-guard |
Hmm... So the sticking point (for the first issue) is that Adding two passes of default mappings to stat could either be done by differentiating the The other issue (setting aesthetics for stats rather than mapping them) is kind of orthogonal. The main issue I can see is if both a stat and a geom share an aesthetic which is then set by the user. What should happen in that case. I'd like to get some input on this from @clauswilke and @yutannihilation as well |
I think the key issue to consider is that A related issue is #3250, where the layer doesn't know which aesthetics should and should not get dropped during the computation. The approach to fixing it that I came up with is to add a slot listing the aesthetics that are dropped during computation: https://github.com/tidyverse/ggplot2/pull/3251/files We should consider these two issues jointly. |
We have |
Also related to #1516 |
Wow, that’s an oldie😀 |
I don't think that's true. As far as I can tell, Geoms have Lines 183 to 190 in bb86d33
Stats have only Lines 152 to 159 in bb86d33
None of these slots are documented in the code: Lines 59 to 63 in bb86d33
Lines 58 to 62 in bb86d33
|
Ah, yeah... I was thinking of |
While writing about extensions I noticed that the content of
default_aes
in a stat is not added to the data before it is passed through thecompute_*()
mill. This effectively renders it useless for anything but defining mappings for the geom.The current code reflects this as it has all sorts of code around extracting non-required aesthetics from the data, e.g. in StatBinHex
ggplot2/R/stat-binhex.r
Lines 45 to 65 in 1223de2
we set a default
weight
, but still has to guard it withdata$weight %||% rep(1L, nrow(data))
when using it incompute_group()
I cannot see any meaningful reason why this is so, and the fix seems obvious. Have I missed an underlying reason @hadley?
The text was updated successfully, but these errors were encountered: