@@ -1072,10 +1072,7 @@ Here we set it to 792.458, which is the true value of light speed
1072
1072
minus 299,000; this ensures it is coded the same way as the
1073
1073
measurements in the ` morley ` data frame.
1074
1074
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" ` .
1079
1076
There is a similar function, ` geom_hline ` ,
1080
1077
that is used for plotting horizontal lines.
1081
1078
Note that
@@ -1085,7 +1082,7 @@ while *horizontal lines* are used to denote quantities on the *vertical axis*.
1085
1082
``` {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."}
1086
1083
morley_hist <- ggplot(morley, aes(x = Speed)) +
1087
1084
geom_histogram() +
1088
- geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1 )
1085
+ geom_vline(xintercept = 792.458, linetype = "dashed")
1089
1086
1090
1087
morley_hist
1091
1088
```
@@ -1114,7 +1111,7 @@ when they are colored by another categorical variable).
1114
1111
``` {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."}
1115
1112
morley_hist <- ggplot(morley, aes(x = Speed, fill = Expt)) +
1116
1113
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")
1118
1115
1119
1116
morley_hist
1120
1117
```
@@ -1139,7 +1136,7 @@ and the color will be mapped discretely.
1139
1136
``` {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."}
1140
1137
morley_hist <- ggplot(morley, aes(x = Speed, fill = as_factor(Expt))) +
1141
1138
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")
1143
1140
1144
1141
morley_hist
1145
1142
```
@@ -1178,7 +1175,7 @@ in the context of the data frame.
1178
1175
morley_hist <- ggplot(morley, aes(x = Speed, fill = as_factor(Expt))) +
1179
1176
geom_histogram() +
1180
1177
facet_grid(rows = vars(Expt)) +
1181
- geom_vline(xintercept = 792.458, linetype = "dashed", linewidth = 1.0 )
1178
+ geom_vline(xintercept = 792.458, linetype = "dashed")
1182
1179
1183
1180
morley_hist
1184
1181
```
@@ -1209,7 +1206,7 @@ morley_hist <- ggplot(morley_rel,
1209
1206
fill = as_factor(Expt))) +
1210
1207
geom_histogram() +
1211
1208
facet_grid(rows = vars(Expt)) +
1212
- geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0 ) +
1209
+ geom_vline(xintercept = 0, linetype = "dashed") +
1213
1210
labs(x = "Relative Accuracy (%)",
1214
1211
y = "# Measurements",
1215
1212
fill = "Experiment ID") +
@@ -1263,7 +1260,7 @@ morley_hist_default <- ggplot(morley_rel,
1263
1260
fill = as_factor(Expt))) +
1264
1261
geom_histogram() +
1265
1262
facet_grid(rows = vars(Expt)) +
1266
- geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0 ) +
1263
+ geom_vline(xintercept = 0, linetype = "dashed") +
1267
1264
labs(x = "Relative Accuracy (%)",
1268
1265
y = "# Measurements",
1269
1266
fill = "Experiment ID") +
@@ -1276,7 +1273,7 @@ morley_hist_big <- ggplot(morley_rel,
1276
1273
fill = as_factor(Expt))) +
1277
1274
geom_histogram(binwidth = 0.1) +
1278
1275
facet_grid(rows = vars(Expt)) +
1279
- geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0 ) +
1276
+ geom_vline(xintercept = 0, linetype = "dashed") +
1280
1277
labs(x = "Relative Accuracy (%)",
1281
1278
y = "# Measurements",
1282
1279
fill = "Experiment ID") +
@@ -1289,7 +1286,7 @@ morley_hist_med <- ggplot(morley_rel,
1289
1286
fill = as_factor(Expt))) +
1290
1287
geom_histogram(binwidth = 0.01) +
1291
1288
facet_grid(rows = vars(Expt)) +
1292
- geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0 ) +
1289
+ geom_vline(xintercept = 0, linetype = "dashed") +
1293
1290
labs(x = "Relative Accuracy (%)",
1294
1291
y = "# Measurements",
1295
1292
fill = "Experiment ID") +
@@ -1302,7 +1299,7 @@ morley_hist_small <- ggplot(morley_rel,
1302
1299
fill = as_factor(Expt))) +
1303
1300
geom_histogram(binwidth = 0.001) +
1304
1301
facet_grid(rows = vars(Expt)) +
1305
- geom_vline(xintercept = 0, linetype = "dashed", linewidth = 1.0 ) +
1302
+ geom_vline(xintercept = 0, linetype = "dashed") +
1306
1303
labs(x = "Relative Accuracy (%)",
1307
1304
y = "# Measurements",
1308
1305
fill = "Experiment ID") +
0 commit comments