Skip to content

Commit 549b418

Browse files
committed
proof edits for chapter 4
1 parent 688d5e7 commit 549b418

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

viz.Rmd

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ alternative.
143143
## Refining the visualization
144144
#### *Convey the message, minimize noise* {-}
145145

146-
Just being able to make a visualization in R with `ggplot2` (or any other tool
146+
Just being able to make a visualization in R (or any other tool
147147
for that matter) doesn't mean that it effectively communicates your message to
148148
others. Once you have selected a broad type of visualization to use, you will
149149
have to refine it to suit your particular need. Some rules of thumb for doing
@@ -186,7 +186,9 @@ understand and remember your message quickly.
186186
#### *Build the visualization iteratively* {-}
187187

188188
This section will cover examples of how to choose and refine a visualization given a data set and a question that you want to answer,
189-
and then how to create the visualization in R \index{ggplot} using `ggplot2`. To use the `ggplot2` package, we need to load the `tidyverse` metapackage.
189+
and then how to create the visualization in R \index{ggplot} using the `ggplot2` R package.
190+
Given that the `ggplot2`package is one of the packages installed
191+
and loaded by the `tidyverse` metapackage, we still only need to load that one package:
190192

191193
```{r 03-tidyverse, warning=FALSE, message=FALSE}
192194
library(tidyverse)
@@ -479,7 +481,8 @@ labels and make the font more readable:
479481
```{r 03-data-faithful-scatter-2, warning=FALSE, message=FALSE, fig.height = 3.5, fig.width = 3.75, fig.align = "center", fig.pos = "H", out.extra="", fig.cap = "Scatter plot of waiting time and eruption time with clearer axes and labels."}
480482
faithful_scatter <- ggplot(faithful, aes(x = waiting, y = eruptions)) +
481483
geom_point() +
482-
labs(x = "Waiting Time (mins)", y = "Eruption Duration (mins)") +
484+
xlab("Waiting Time (mins)") +
485+
ylab("Eruption Duration (mins)") +
483486
theme(text = element_text(size = 12))
484487
485488
faithful_scatter
@@ -529,8 +532,8 @@ improve readability.
529532
```{r 03-mother-tongue-vs-most-at-home-labs, fig.height=3.5, fig.width=3.75, fig.align = "center", warning=FALSE, fig.pos = "H", out.extra="", fig.cap = "Scatter plot of number of Canadians reporting a language as their mother tongue vs the primary language at home with x and y labels."}
530533
ggplot(can_lang, aes(x = most_at_home, y = mother_tongue)) +
531534
geom_point() +
532-
labs(x = "Language spoken most at home \n (number of Canadian residents)",
533-
y = "Mother tongue \n (number of Canadian residents)") +
535+
xlab("Language spoken most at home \n (number of Canadian residents)") +
536+
ylab("Mother tongue \n (number of Canadian residents)") +
534537
theme(text = element_text(size = 12))
535538
```
536539

@@ -596,8 +599,8 @@ library(scales)
596599
597600
ggplot(can_lang, aes(x = most_at_home, y = mother_tongue)) +
598601
geom_point() +
599-
labs(x = "Language spoken most at home \n (number of Canadian residents)",
600-
y = "Mother tongue \n (number of Canadian residents)") +
602+
xlab("Language spoken most at home \n (number of Canadian residents)") +
603+
ylab("Mother tongue \n (number of Canadian residents)") +
601604
theme(text = element_text(size = 12)) +
602605
scale_x_log10(labels = label_comma()) +
603606
scale_y_log10(labels = label_comma())
@@ -651,8 +654,8 @@ the final result.
651654
```{r 03-mother-tongue-vs-most-at-home-scale-props, fig.height=3.5, fig.width=3.75, fig.align = "center", warning=FALSE, fig.pos = "H", out.extra="", fig.cap = "Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home."}
652655
ggplot(can_lang, aes(x = most_at_home_percent, y = mother_tongue_percent)) +
653656
geom_point() +
654-
labs(x = "Language spoken most at home \n (percentage of Canadian residents)",
655-
y = "Mother tongue \n (percentage of Canadian residents)") +
657+
xlab("Language spoken most at home \n (percentage of Canadian residents)") +
658+
ylab("Mother tongue \n (percentage of Canadian residents)") +
656659
theme(text = element_text(size = 12)) +
657660
scale_x_log10(labels = comma) +
658661
scale_y_log10(labels = comma)
@@ -710,8 +713,8 @@ ggplot(can_lang, aes(x = most_at_home_percent,
710713
y = mother_tongue_percent,
711714
color = category)) +
712715
geom_point() +
713-
labs(x = "Language spoken most at home \n (percentage of Canadian residents)",
714-
y = "Mother tongue \n (percentage of Canadian residents)") +
716+
xlab("Language spoken most at home \n (percentage of Canadian residents)") +
717+
ylab("Mother tongue \n (percentage of Canadian residents)") +
715718
theme(text = element_text(size = 12)) +
716719
scale_x_log10(labels = comma) +
717720
scale_y_log10(labels = comma)
@@ -736,8 +739,8 @@ ggplot(can_lang, aes(x = most_at_home_percent,
736739
y = mother_tongue_percent,
737740
color = category)) +
738741
geom_point() +
739-
labs(x = "Language spoken most at home \n (percentage of Canadian residents)",
740-
y = "Mother tongue \n (percentage of Canadian residents)") +
742+
xlab("Language spoken most at home \n (percentage of Canadian residents)") +
743+
ylab("Mother tongue \n (percentage of Canadian residents)") +
741744
theme(text = element_text(size = 12),
742745
legend.position = "top",
743746
legend.direction = "vertical") +
@@ -783,8 +786,8 @@ ggplot(can_lang, aes(x = most_at_home_percent,
783786
color = category,
784787
shape = category)) +
785788
geom_point() +
786-
labs(x = "Language spoken most at home \n (percentage of Canadian residents)",
787-
y = "Mother tongue \n (percentage of Canadian residents)") +
789+
xlab("Language spoken most at home \n (percentage of Canadian residents)") +
790+
ylab("Mother tongue \n (percentage of Canadian residents)") +
788791
theme(text = element_text(size = 12),
789792
legend.position = "top",
790793
legend.direction = "vertical") +
@@ -1087,7 +1090,7 @@ instead of stacked bars
10871090
(which is the default for bar plots or histograms
10881091
when they are colored by another categorical variable).
10891092

1090-
```{r 03-data-morley-hist-3, warning=FALSE, message=FALSE, fig.height = 2.75, fig.width = 4.5, fig.align = "center", fig.pos = "H", out.extra="", fig.cap = "Histogram of Michelson's speed of light data colored by experiment."}
1093+
```{r 03-data-morley-hist-3, warning=FALSE, message=FALSE, fig.height = 2.75, fig.width = 4.5, fig.align = "center", fig.pos = "H", out.extra="", fig.cap = "Histogram of Michelson's speed of light data where an attempt is made to color the bars by experiment."}
10911094
morley_hist <- ggplot(morley, aes(x = Speed, fill = Expt)) +
10921095
geom_histogram(alpha = 0.5, position = "identity") +
10931096
geom_vline(xintercept = 792.458, linetype = "dashed", size = 1.0)
@@ -1500,7 +1503,7 @@ JPG format is twice as large as the PNG format since the JPG compression
15001503
algorithm is designed for natural images (not plots).
15011504

15021505
In Figure \@ref(fig:03-raster-image), we also show what
1503-
the images look like when we zoom in to a rectangle with only 3 data points.
1506+
the images look like when we zoom in to a rectangle with only 2 data points.
15041507
You can see why vector graphics formats are so useful: because they're just
15051508
based on mathematical formulas, vector graphics can be scaled up to arbitrary
15061509
sizes. This makes them great for presentation media of all sizes, from papers

0 commit comments

Comments
 (0)