Skip to content

Commit 71a0f67

Browse files
dotted to dashed vert rule in reg1; thinner default dash in viz
1 parent 072a8a7 commit 71a0f67

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

source/regression1.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ small_plot <- ggplot(small_sacramento, aes(x = sqft, y = price)) +
222222
xlab("House size (square feet)") +
223223
ylab("Price (USD)") +
224224
scale_y_continuous(labels = dollar_format()) +
225-
geom_vline(xintercept = 2000, linetype = "dotted") +
225+
geom_vline(xintercept = 2000, linetype = "dashed") +
226226
theme(text = element_text(size = 12))
227227
228228
small_plot

source/viz.Rmd

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,7 @@ Here we set it to 792.458, which is the true value of light speed
10721072
minus 299,000; this ensures it is coded the same way as the
10731073
measurements in the `morley` data frame.
10741074
We would also like to fine tune this vertical line,
1075-
styling it so that it is dashed and 1 point in thickness.
1076-
A point is a measurement unit commonly used with fonts,
1077-
and 1 point is about 0.353 mm.
1078-
We do this by setting `linetype = "dashed"` and `linewidth = 1`, respectively.
1075+
styling it so that it is dashed by setting `linetype = "dashed"`.
10791076
There is a similar function, `geom_hline`,
10801077
that is used for plotting horizontal lines.
10811078
Note that
@@ -1085,7 +1082,7 @@ while *horizontal lines* are used to denote quantities on the *vertical axis*.
10851082
```{r 03-data-morley-hist-2, warning=FALSE, fig.height = 2.75, fig.width = 4.5, fig.align = "center", fig.pos = "H", out.extra="", message=FALSE,fig.cap = "Histogram of Michelson's speed of light data with vertical line indicating true speed of light."}
10861083
morley_hist <- ggplot(morley, aes(x = Speed)) +
10871084
geom_histogram() +
1088-
geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1)
1085+
geom_vline(xintercept = 792.458, linetype = "dashed")
10891086
10901087
morley_hist
10911088
```
@@ -1114,7 +1111,7 @@ when they are colored by another categorical variable).
11141111
```{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."}
11151112
morley_hist <- ggplot(morley, aes(x = Speed, fill = Expt)) +
11161113
geom_histogram(alpha = 0.5, position = "identity") +
1117-
geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1.0)
1114+
geom_vline(xintercept = 792.458, linetype = "dashed")
11181115
11191116
morley_hist
11201117
```
@@ -1139,7 +1136,7 @@ and the color will be mapped discretely.
11391136
```{r 03-data-morley-hist-with-factor, warning=FALSE, message=FALSE, fig.height = 2.75, fig.width = 5, fig.pos = "H", out.extra="", fig.align = "center", fig.cap = "Histogram of Michelson's speed of light data colored by experiment as factor."}
11401137
morley_hist <- ggplot(morley, aes(x = Speed, fill = as_factor(Expt))) +
11411138
geom_histogram(alpha = 0.5, position = "identity") +
1142-
geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1.0)
1139+
geom_vline(xintercept = 792.458, linetype = "dashed")
11431140
11441141
morley_hist
11451142
```
@@ -1178,7 +1175,7 @@ in the context of the data frame.
11781175
morley_hist <- ggplot(morley, aes(x = Speed, fill = as_factor(Expt))) +
11791176
geom_histogram() +
11801177
facet_grid(rows = vars(Expt)) +
1181-
geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1.0)
1178+
geom_vline(xintercept = 792.458, linetype = "dashed")
11821179
11831180
morley_hist
11841181
```
@@ -1209,7 +1206,7 @@ morley_hist <- ggplot(morley_rel,
12091206
fill = as_factor(Expt))) +
12101207
geom_histogram() +
12111208
facet_grid(rows = vars(Expt)) +
1212-
geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0) +
1209+
geom_vline(xintercept = 0, linetype = "dashed") +
12131210
labs(x = "Relative Accuracy (%)",
12141211
y = "# Measurements",
12151212
fill = "Experiment ID") +
@@ -1263,7 +1260,7 @@ morley_hist_default <- ggplot(morley_rel,
12631260
fill = as_factor(Expt))) +
12641261
geom_histogram() +
12651262
facet_grid(rows = vars(Expt)) +
1266-
geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0) +
1263+
geom_vline(xintercept = 0, linetype = "dashed") +
12671264
labs(x = "Relative Accuracy (%)",
12681265
y = "# Measurements",
12691266
fill = "Experiment ID") +
@@ -1276,7 +1273,7 @@ morley_hist_big <- ggplot(morley_rel,
12761273
fill = as_factor(Expt))) +
12771274
geom_histogram(binwidth = 0.1) +
12781275
facet_grid(rows = vars(Expt)) +
1279-
geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0) +
1276+
geom_vline(xintercept = 0, linetype = "dashed") +
12801277
labs(x = "Relative Accuracy (%)",
12811278
y = "# Measurements",
12821279
fill = "Experiment ID") +
@@ -1289,7 +1286,7 @@ morley_hist_med <- ggplot(morley_rel,
12891286
fill = as_factor(Expt))) +
12901287
geom_histogram(binwidth = 0.01) +
12911288
facet_grid(rows = vars(Expt)) +
1292-
geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0) +
1289+
geom_vline(xintercept = 0, linetype = "dashed") +
12931290
labs(x = "Relative Accuracy (%)",
12941291
y = "# Measurements",
12951292
fill = "Experiment ID") +
@@ -1302,7 +1299,7 @@ morley_hist_small <- ggplot(morley_rel,
13021299
fill = as_factor(Expt))) +
13031300
geom_histogram(binwidth = 0.001) +
13041301
facet_grid(rows = vars(Expt)) +
1305-
geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0) +
1302+
geom_vline(xintercept = 0, linetype = "dashed") +
13061303
labs(x = "Relative Accuracy (%)",
13071304
y = "# Measurements",
13081305
fill = "Experiment ID") +

0 commit comments

Comments
 (0)