Data Visualization a Practical Introduction
Start by playing around with the gapminder data a little more. You can try each of these explorations with geom_point() and then with geom_smooth(), or both together.
- What happens when you put the
geom_smooth()function beforegeom_point()instead of after it? What does this tell you about how the plot is drawn? Think about how this might be useful when drawing plots. - Change the mappings in the
aes()function so that you plot Life Expectancy against population (pop) rather than per capita GDP. What does that look like? What does it tell you about the unit of observation in the dataset? - Try some alternative scale mappings. Besides
scale_x_log10()you can tryscale_x_sqrt()andscale_x_reverse(). There are corresponding functions for y-axis transformations. Just writeyinstead ofx. Experiment with them to see what sort of effect they have on the plot, and whether they make any sense to use. - What happens if you map
colortoyearinstead ofcontinent? Is the result what you expected? Think about what class of objectyearis. Remember you can get a quick look at the top of the data, which includes some shorthand information on the class of each variable, by typinggapminder. - Instead of mapping
color = year, what happens if you trycolor = factor(year)?
7 years ago
10
Answer(0)
other Questions(10)
- ARTS 100 Week 5 Individual Assignment Architecture Paper
- AJS 512 Week 2 Learning Team Assignment Reinforcement Strategies Paper
- Homework 6
- Primary Essay FOR A-PLUS WRITER ONLY
- Summarize the role of operations and supply chain management in service industries in 100 words
- Archaeology
- Dennis Wright
- Project for comp_sci_pro only (2)
- Financial Statement Analysis
- math homework