Skip to content

Commit

Permalink
Adding workshop files
Browse files Browse the repository at this point in the history
  • Loading branch information
amzoss committed Sep 7, 2018
1 parent 2a4b2c2 commit 2f84396
Show file tree
Hide file tree
Showing 98 changed files with 35,296 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
180 changes: 180 additions & 0 deletions 1-got_nyt.Rmd
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
```
Loading

0 comments on commit 2f84396

Please sign in to comment.