What is a Plot?

🕵️‍♀ Question: 大家都知道哪些统计图形?

运行这个代码,你会发现,这个图形是由一系列的点组成的,这些点的位置是由 x 和 y 决定的,而点的颜色是由 class 决定的。

ggplot(data = mpg,

       mapping = aes(x = displ,
                     y = hwy,
                     colour = class)) +

  geom_point()

🕵️‍♀ Question: 这一个统计图由哪些元素构成的?

- Data(数据集)
- Aesthetics(美学映射)
- Geometry(几何对象)

Source: Create Elegant Data Visualisations Using the Grammar of Graphics. (2023, December 18). Retrieved from https://ggplot2.tidyverse.org