Coding Lab: Visualizing data with ggplot2
Ari Anisfeld Summer 2020
1 / 36
Coding Lab: Visualizing data with ggplot2 Ari Anisfeld Summer 2020 - - PowerPoint PPT Presentation
Coding Lab: Visualizing data with ggplot2 Ari Anisfeld Summer 2020 1 / 36 How to use ggplot How to map data to aesthetics with aes() (and what that means) How to visualize the mappings with geom s How to get more out of your data by
1 / 36
2 / 36
3 / 36
◮ R will map that to the coordinate pair (x,y) . ◮ Look at the data before moving on!
4 / 36
5 / 36
6 / 36
7 / 36
8 / 36
9 / 36
10 / 36
11 / 36
◮ Each state is assigned a color. ◮ This works with discrete data and continuous data.
12 / 36
◮ Each state is assigned a shape. ◮ This works with discrete data only.
13 / 36
◮ Here we map the percentage of people within a known poverty
14 / 36
◮ Here we map the percentage of people within a known poverty
15 / 36
16 / 36
17 / 36
◮ the bold aesthetics are required.
18 / 36
19 / 36
◮ If you do group_by with the var and there are fewer than 6 to
◮ If your “discrete” data is numeric, as.character() or
20 / 36
21 / 36
22 / 36
23 / 36
24 / 36
◮ e.g. What data shows up on x and y axes and how color,
◮ We need to be aware of ‘continuous’ vs. ‘discrete’ variables.
◮ Again we need to be aware of ‘continuous’ vs. ‘discrete’
25 / 36
26 / 36
27 / 36
28 / 36
29 / 36
30 / 36
31 / 36
32 / 36
33 / 36
34 / 36
35 / 36
36 / 36