Homework 5: Graphics
Note: This assignment must be submitted in github classroom.
Data Exploration
One extremely important use of charts is to explore new datasets. In order to get the most out of a dataset, however, it is important to use a chart that is suited to the type of data: a density plot will not work well for showing categorical data, for instance.
For each variable in the groundhogs data that contains useful information, find an appropriate plot for the data. You may show more than one variable in a single plot (latitude and longitude should probably be shown together). You may use either R or python for this task.
groundhogs.csv
- lat, long
- country
- isGroundhog
- active
- predictionsCount
predictions.csv
- isGroundhog
- year
- shadow
For each plot you draw, write 1-2 sentences explaining what you can learn from the plot.
This plot shows…
Grammar of Graphics
Think of a good way to answer the following questions with a plot. For each plot, write 1-2 sentences explaining why you mapped each variable in the way that you did. Use ggplot2 for this portion of the assignment.
You may make editorial decisions here - it may be useful to only show groundhogs with 20 years of predictions, for instance. If you make such decisions, please explain why.
Your charts must have appropriate axis labels and titles.
Do different groundhogs have different probabilities of predicting 6 more weeks of winter?
I mapped … to x and … to y because…
How much do North American groundhogs tend to agree on their predictions?
Does there appear to be any spatial covariance (that is, are groundhogs who are close together more likely to predict the same thing?)
I mapped … to x and … to y because…
Ugly Chart Challenge
The textbook spent lots of time showing you how to create different types of graphics, but I spent a lot less time showing you all of the different ways you could customize graphics in any plotting library. In this problem, I want you to create the ugliest graph you can, and then explain why, exactly, you made the decisions you did, and which principles of good graphics you’ve intentionally violated.
Ugliness is subjective, so the goal here is for you to explore the different ways you can customize the finer details of a plot. Make sure your finished masterpiece has appropriate axis labels and a title (after all, even ugly plots need to be correctly labeled!). You are free to add additional variables and layers, modify the aesthetics used, and leverage other packages. If you need inspiration, look here.
Use the groundhog data to create the ugliest chart you possibly can, by violating as many guidelines for the creation of good graphics as possible.
Do this for one plotting system in R, and one plotting system in Python. You might try different ways to make things ugly in each plotting system. Note that this dataset does include images of each groundhog, so feel free to leverage that in your plot, if you are so inspired.
For each plot, explain why the plot is ugly and what principles of good graphics it violates in 2-3 sentences.
R
This chart is ugly because it violates …
Python
This chart is ugly because it violates …