ggplot2
ggplot2 copied to clipboard
Use ggplot2_global in aes_to_scale
I discovered that coord$transform()
doesn't transforms all the x and y aesthetics that are given in ggplot_global$x_aes
/ggplot2_global$y_aes
. Indeed, aes_to_scale()
which is used in transform_position()
has it's own hard coded values to look up.
It seems to me this is a leftover from back when we didn't have a central repository for positional aesthetic names and we should change it... however I'm hazy on whether it would have unforeseen consequences...
@clauswilke @yutannihilation and @Hadley any thoughts agains?
Does the current code create incorrect transformations for some geoms? One would think so, but I'm not aware of any bug reports. Maybe it requires rather obscure input.
My main concern would be with transforming aesthetics that represent distances rather than positions (e.g., width
or height
), but those don't seem to be present in ggplot_global$x_aes
/ggplot2_global$y_aes
.
It isn't used anywhere in the ggplot2 code base which is why we haven't caught it. But in ggforce I tried having x0
and y0
aesthetics and was perplexed why they weren't transformed seeing that they are valid positional aesthetics. So the fix is mostly for my own sake and for internal consistency
I see. In any case, it sounds reasonable to me to make this fix.
I don't know well about these positional aesthetics, but it sounds fine to me.