Today we make more graphs and we make them more pretty.
A reminder: the goal here is not for you to be able to open a blank piece of paper and start writing long, elegant code straight from your brain. Even if you are expert coders, that is not particularly efficient. Rather, our goal is that by working through these activities, we learn (1) what the possibilities are; (b) build familiarity with how to work with them; and (c) create an set of templates to draw from that you are already familiar with.
Start by changing your name above! You may want to change the title - it’s not a template anymore!
Complete the following primers:
As before, I would recommend working through them both in the tutorial and in a separate .Rmd file on your computer - it will be useful to have all the written examples together.
Load all the libraries you need here, so you don’t have to worry about it later on:
Paste the code you used to create the plot for “global vs local data” section of the Layers section:the graph of engine displacement vs. highway mileage where just some points are highlighted red.
Using the last_plot()
command to call the previous graph, add the title “Sports cars have bad gas mileage.” (or whatever title you like better)
Recreate your code to complete Review 3 in “Similar Geoms”, where were make the cool area map of life expectancy across three countries in Asia that isn’t all messed up:
Using the last_plot()
command to call the previous graph, add two layers: 1. A minimal theme, using theme_minimal()
2. A different color palette, using scale_fill_brewer(palette = "Spectral")
If “Spectral” isn’t for you, you can explore other palettes here or by typing RColorBrewer::display.brewer.all()
in the command window. The default is nice, but not interpretable for this type of plot
Recreate your code from the Quiz at the end of Customizing your plots. You made a beautiful thing!
# Put your code here! Make sure it runs
In this space, type your answer to the following prompts (no word limit):
What is your favorite color palette so far?
What is your favorite geom
from this section?
Were there any particular successes you had?
What are 2 questions you had or concepts you felt uncomfortable with?
Finally, knit this document to Word, html, or PDF and upload into Blackboard.
tinytex
package. This is a two-step process. Andrew Heiss provides the clearest explanation.Note: If you get a weird error message about Error in contrib.url(repos,"source")...
comment out the two lines that install your packages.