Repository navigation
Fix after_scale() with plot mappings - #4265
yutannihilation merged 9 commits into
Conversation
This is against the grain of the mainly functional style in the codebase, but somewhere in a "setup" function of the layer you could resolve the effective mapping for each layer, kind of similar to how a copy of the data is generated for each layer at the start of the plot build. if (self$inherit.aes) {
self$mapping <- defaults(self$mapping, plot$mapping)
} |
|
Thanks, it sounds nice, but I'm not yet sure when is safe to modify the layer... |
Here Lines 34 to 35 in a132727 Just like there is certainty about the data at that point, there is also certainty about the aesthetics. |
|
I'm not sure I fully understand the problem, but would a fix fit into the Lines 205 to 207 in a132727 See e.g. what we do for sf-specific layers: Lines 35 to 71 in a132727 We could just finalize the layer mapping in that function and then remove this code from Lines 290 to 296 in a132727 |
Yes it would. |
|
What I'm not confident is, whether there is really no case (including extension packages) when we need to distinguish inherited mappings and layer's original mappings. But, considering we already do tweak the mappings in |
|
This isn't a very big problem, but, interestingly, adding these lines in |
|
@yutannihilation where are we on this? Your last comment indicates that it is still not done? |
|
Ah, sorry I forgot to add a comment, but the concern in my last comment was addressed by this commit. So, I think this is ready now (except for the conflict). |
|
Thanks, I'll merge this after confirming the CI passes |
Fix #4260
This feels a bit uneasy to repeatThis pull request movesdefaults(layer$mapping, plot$mapping)everywhere, but I don't come up with a nice idea... Any suggestions are welcome.defaults(layer$mapping, plot$mapping)tosetup_layer()so that we don't need to do it in individual methods that refer to the mapping.Created on 2020-11-15 by the reprex package (v0.3.0)