When I teach about ggplot2 I struggle to say the mapping in the right "direction." That is, it seems more natural to me to say,
"we map mpg
to x
and disp
to y
"
rather than
"we map x
to mpg
and y
to disp
"
Is there some intuition/explanation for why it is the other way around? To me, it seems like I have the data, and then I'm trying to put it on (virtual) paper. I just went and looked in the Grammar of Graphics, and it seems like Wilkinson was talking about mapping in this way, with "A map f: S -> P" where S is mathematical space and P is physical space.
Is the R implementation of the grammar of graphics the other way around because of the named arguments? I understand that the arguments go x=mpg
, so maybe the phrasing of the mapping is to make sense with the "directionality" of the assignment? But, in other places where we do assignment, we phrase it differently, as in x <- 5
or "x gets 5."
Maybe Hadley knows?