hadley / ggplot2-book

ggplot2: elegant graphics for data analysis
https://ggplot2-book.org/
1.57k stars 683 forks source link

TERMINOLOGY: Mapping of aesthetics -> variables, variables -> aesthetics, or aesthetics <-> variables? #314

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 2 years ago

In https://github.com/hadley/ggplot2-book/blob/01734fa9361eb1ce6ff954d77fa2d6c01f10430b/mastery.Rmd#L33 we can read:

Each aesthetic can be mapped to a variable, or set to a constant value. In the previous graphic, displ is mapped to horizontal position, hwy to vertical position and cyl to colour. Size and shape are not mapped to variables, but remain at their (constant) default values.

  1. The first sentence talks about mapping aesthetics -> variables
  2. The second sentence talks about mapping variables -> aesthetics
  3. The third sentence talks about mapping aesthetics -> variables

Is (aesthetics, variables) mapping meant to be bijective, or one way only? I'm not sure if it matters when it comes to your description of scales. At least for grammatical parallelization, the second sentence could be rephrased to something like:

In the previous graphic, horizontal position is mapped to displ, vertical position to hwy, and colour to cyl.

HenrikBengtsson commented 2 years ago

Reading more about scales, I realize it should probably be variables -> aesthetics

hadley commented 1 year ago

I tweaked the wording a bit to try and make that more clear.