-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
35,296 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
--- | ||
title: "Game of Thromes Character Ratings" | ||
author: "Angela Zoss" | ||
date: "9/7/2018" | ||
output: html_document | ||
--- | ||
|
||
```{r setup, include=FALSE} | ||
knitr::opts_chunk$set(echo = FALSE, message=FALSE) | ||
``` | ||
|
||
## Setup your environment | ||
|
||
```{r} | ||
# Load required libraries | ||
library(tidyverse) | ||
``` | ||
|
||
## Load your data | ||
|
||
```{r} | ||
# data comes from https://int.nyt.com/newsgraphics/2017/2017-07-17-got-matrix/mean.json | ||
# data based on ratings using tool at https://www.nytimes.com/interactive/2017/08/09/upshot/game-of-thrones-chart.html | ||
got <- read_csv("data/got_ratings.csv") | ||
``` | ||
|
||
## Create a basic plot | ||
|
||
```{r} | ||
# a plot should include: | ||
# - a call to ggplot() | ||
# - a dataset | ||
# - a call to aes(), including the main x and y variables | ||
# - a geom layer that specifies the type of chart or shape | ||
``` | ||
|
||
## Set the size of all points to 5 | ||
|
||
```{r} | ||
# hint: check ?geom_point to see the different aesthetics options available, but think carefully | ||
# about where the new option should go in the function | ||
``` | ||
|
||
## Set the alpha (transparency) of all points to .75 | ||
|
||
```{r} | ||
``` | ||
|
||
## Add labels | ||
|
||
```{r} | ||
# hint: check https://ggplot2.tidyverse.org/reference/#section-layer-geoms for all geom options | ||
``` | ||
|
||
## Fix label overlap | ||
|
||
```{r} | ||
# hint: look at ?geom_text for a property that might change the position slightly | ||
# once you've found something to try, be careful: are you adding a new variable, or is it a constant change? | ||
``` | ||
|
||
## Add colors | ||
|
||
```{r} | ||
# add gender as a color three different ways: | ||
# - points only | ||
# - labels only | ||
# - both | ||
``` | ||
|
||
## Turn off legend for text layer | ||
|
||
```{r} | ||
# hint: there is another property for the geom_text layer that might help | ||
``` | ||
|
||
|
||
## Switch direction of Y axis | ||
|
||
```{r} | ||
# hint: edits to axes often use scales | ||
# check https://ggplot2.tidyverse.org/reference/#section-scales for pre-built scales | ||
# that might help (focus on scales for the y-axis) | ||
``` | ||
|
||
## Add reference lines | ||
|
||
```{r} | ||
# hint: there are special geoms for straight lines; | ||
# check https://ggplot2.tidyverse.org/reference/#section-layer-geoms for all geom options | ||
``` | ||
|
||
```{r} | ||
# look at how ggplot2 is layering the plot; rearrange layers as needed | ||
``` | ||
|
||
## Change the theme | ||
|
||
```{r} | ||
# Try to find a theme closer to the NYT chart; | ||
# see https://ggplot2.tidyverse.org/reference/#section-themes for built-in themes | ||
``` | ||
|
||
## Change axis limits | ||
|
||
```{r} | ||
# the chart might look better if the axes go all the way from 0 to 1; edit | ||
# the axes to force them to include 0 and 1 | ||
# hint: remember that changes to axes usually involve a scale | ||
``` | ||
|
||
## Annotate the axes with descriptive text | ||
|
||
```{r} | ||
# hint: geoms are typically best for chart elements involving data; | ||
# look for another feature that can add text to charts | ||
# https://ggplot2.tidyverse.org/reference/ | ||
``` | ||
|
||
## Add a main title | ||
|
||
```{r} | ||
# check https://ggplot2.tidyverse.org/reference/ for likely layers | ||
``` |
Oops, something went wrong.