Skip to content

Commit 82c97f2

Browse files
committed
updates for Fall 2019
1 parent 88a61c2 commit 82c97f2

File tree

7 files changed

+4
-47
lines changed

7 files changed

+4
-47
lines changed

1-got_nyt.Rmd

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ got <- read_csv("data/got_ratings.csv")
3232
3333
# Remember the basic steps:
3434
# - set the data (main function)
35-
# - choose a shape layer
3635
# - map variables to aesthetics using aes() -> start with x and y in main function
36+
# - choose a shape layer
3737
3838
3939
@@ -94,12 +94,3 @@ got <- read_csv("data/got_ratings.csv")
9494
9595
```
9696

97-
## Split the chart up into separate charts for each family (loyalty group)
98-
99-
```{r}
100-
101-
# Hint: check https://ggplot2.tidyverse.org/reference/ for facet layers
102-
103-
104-
105-
```

1-got_nyt_final.Rmd

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ got <- read_csv("data/got_ratings.csv")
3232
3333
# Remember the basic steps:
3434
# - set the data (main function)
35-
# - choose a shape layer
3635
# - map variables to aesthetics using aes() -> start with x and y in main function
36+
# - choose a shape layer
3737
3838
ggplot(got, aes(x=moral,y=physical)) +
3939
geom_point()
@@ -116,15 +116,3 @@ ggplot(got, aes(x=moral,y=physical, color=gender)) +
116116
117117
```
118118

119-
## Split the chart up into separate charts for each family(loyalty group)
120-
121-
```{r}
122-
123-
# Hint: check https://ggplot2.tidyverse.org/reference/ for facet layers
124-
125-
ggplot(got, aes(x=moral,y=physical, color=gender)) +
126-
geom_point(alpha=.75) +
127-
geom_text(aes(label=label), nudge_y = -.015, show.legend = FALSE) +
128-
facet_wrap(vars(loyalty))
129-
130-
```

2-starwars_characters.Rmd

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,5 @@ starwars_chars <- starwars
7575
7676
7777
78-
```
79-
80-
## Add a label to (only) the shortest character
81-
82-
```{r}
83-
84-
85-
8678
```
8779

2-starwars_characters_final.Rmd

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,10 @@ ggplot(starwars_chars, aes(height,mass)) +
8484
geom_smooth(method = "lm", se=FALSE) +
8585
geom_text(data=starwars_chars %>% dplyr::filter(mass > 1000), aes(label=name), nudge_y = -50)
8686
87-
```
88-
89-
## Add a label to (only) the shortest character
90-
91-
```{r}
92-
9387
ggplot(starwars_chars, aes(height,mass)) +
9488
geom_point() +
9589
geom_smooth(method = "lm", se=FALSE) +
96-
geom_text(data=starwars_chars %>% dplyr::filter(mass > 1000), aes(label=name), nudge_y = -50) +
97-
geom_text(data=starwars_chars %>% dplyr::filter(height < 75), aes(label=name), nudge_y = 50)
98-
99-
# or
100-
ggplot(starwars_chars, aes(height,mass)) +
101-
geom_point() +
102-
geom_smooth(method = "lm", se=FALSE) +
103-
geom_text(data=starwars_chars %>% dplyr::filter(mass == max(mass, na.rm=T) | height == min(height, na.rm=T)), aes(label=name), nudge_y = 50)
104-
90+
geom_text(data=starwars_chars %>% dplyr::filter(mass == max(mass, na.rm=T)), aes(label=name), nudge_y = -50)
10591
10692
```
10793

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
This repo contains files for a hands-on workshop on ggplot2, the visualization package for R.
44

5-
Main exercise files are numbered in the top-level directory. Solutions for exercises can be found in the "-final" files. The "templates" directory includes a templates file with a variety of chart types.
5+
Main exercise files are numbered in the top-level directory. Solutions for exercises can be found in the "_final" files. The "templates" directory includes a templates file with a variety of chart types.
66

77
Videos of this and similar workshops are made available in the Duke University Libraries Center for Data and Visualization Sciences [video archive](http://bit.ly/DVSvideos).

ggplot2-handout.pdf

-51.9 KB
Binary file not shown.

ggplot2-slides.pdf

3.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)