@@ -239,8 +239,8 @@ cancer |>
239
239
240
240
Next, let's draw a scatter plot \index{visualization!scatter} to visualize the relationship between the
241
241
perimeter and concavity variables. Rather than use ` ggplot's ` default palette,
242
- we select our own colorblind-friendly colors&mdash ; ` "orange2 " `
243
- for light orange and ` "steelblue2 " ` for light blue&mdash ; and
242
+ we select our own colorblind-friendly colors&mdash ; ` "darkorange " `
243
+ for orange and ` "steelblue " ` for blue&mdash ; and
244
244
pass them as the ` values ` argument to the ` scale_color_manual ` function.
245
245
246
246
``` {r 05-scatter, fig.height = 3.5, fig.width = 4.5, fig.cap= "Scatter plot of concavity versus perimeter colored by diagnosis label."}
@@ -250,7 +250,7 @@ perim_concav <- cancer |>
250
250
labs(x = "Perimeter (standardized)",
251
251
y = "Concavity (standardized)",
252
252
color = "Diagnosis") +
253
- scale_color_manual(values = c("orange2 ", "steelblue2 ")) +
253
+ scale_color_manual(values = c("darkorange ", "steelblue ")) +
254
254
theme(text = element_text(size = 12))
255
255
perim_concav
256
256
```
@@ -334,7 +334,7 @@ perim_concav_with_new_point <- bind_rows(cancer,
334
334
labs(color = "Diagnosis", x = "Perimeter (standardized)",
335
335
y = "Concavity (standardized)") +
336
336
scale_color_manual(name = "Diagnosis",
337
- values = c("steelblue2 ", "orange2 ", "red")) +
337
+ values = c("steelblue ", "darkorange ", "red")) +
338
338
scale_shape_manual(name = "Diagnosis",
339
339
values= c(16, 16, 18))+
340
340
scale_size_manual(name = "Diagnosis",
@@ -389,7 +389,7 @@ perim_concav_with_new_point2 <- bind_rows(cancer,
389
389
x = "Perimeter (standardized)",
390
390
y = "Concavity (standardized)") +
391
391
scale_color_manual(name = "Diagnosis",
392
- values = c("steelblue2 ", "orange2 ", "red")) +
392
+ values = c("steelblue ", "darkorange ", "red")) +
393
393
scale_shape_manual(name = "Diagnosis",
394
394
values= c(16, 16, 18))+
395
395
scale_size_manual(name = "Diagnosis",
@@ -484,7 +484,7 @@ perim_concav <- bind_rows(cancer,
484
484
breaks = seq(-2, 4, 1)) +
485
485
labs(color = "Diagnosis") +
486
486
scale_color_manual(name = "Diagnosis",
487
- values = c("steelblue2 ", "orange2 ", "red")) +
487
+ values = c("steelblue ", "darkorange ", "red")) +
488
488
scale_shape_manual(name = "Diagnosis",
489
489
values= c(16, 16, 18))+
490
490
scale_size_manual(name = "Diagnosis",
@@ -628,7 +628,7 @@ plot_3d <- scaled_cancer_3 |>
628
628
color = ~Class,
629
629
opacity = 0.4,
630
630
size = 2,
631
- colors = c("steelblue2 ", "orange2 ", "red"),
631
+ colors = c("steelblue ", "darkorange ", "red"),
632
632
symbol = ~Class, symbols = c('circle','circle','diamond'))
633
633
634
634
x1 <- c(pull(new_obs_3[1]), data$Perimeter[1])
@@ -653,15 +653,15 @@ z5 <- c(pull(new_obs_3[3]), data$Symmetry[5])
653
653
654
654
plot_3d <- plot_3d |>
655
655
add_trace(x = x1, y = y1, z = z1, type = "scatter3d", mode = "lines",
656
- name = "lines", showlegend = FALSE, color = I("orange2 ")) |>
656
+ name = "lines", showlegend = FALSE, color = I("darkorange ")) |>
657
657
add_trace(x = x2, y = y2, z = z2, type = "scatter3d", mode = "lines",
658
- name = "lines", showlegend = FALSE, color = I("orange2 ")) |>
658
+ name = "lines", showlegend = FALSE, color = I("darkorange ")) |>
659
659
add_trace(x = x3, y = y3, z = z3, type = "scatter3d", mode = "lines",
660
- name = "lines", showlegend = FALSE, color = I("orange2 ")) |>
660
+ name = "lines", showlegend = FALSE, color = I("darkorange ")) |>
661
661
add_trace(x = x4, y = y4, z = z4, type = "scatter3d", mode = "lines",
662
- name = "lines", showlegend = FALSE, color = I("steelblue2 ")) |>
662
+ name = "lines", showlegend = FALSE, color = I("steelblue ")) |>
663
663
add_trace(x = x5, y = y5, z = z5, type = "scatter3d", mode = "lines",
664
- name = "lines", showlegend = FALSE, color = I("orange2 "))
664
+ name = "lines", showlegend = FALSE, color = I("darkorange "))
665
665
666
666
if(!is_latex_output()){
667
667
plot_3d
@@ -966,7 +966,7 @@ unscaled <- ggplot(unscaled_cancer, aes(x = Area,
966
966
shape = Class, size = Class)) +
967
967
geom_point(alpha = 0.6) +
968
968
scale_color_manual(name = "Diagnosis",
969
- values = c("steelblue2 ", "orange2 ", "red")) +
969
+ values = c("steelblue ", "darkorange ", "red")) +
970
970
scale_shape_manual(name = "Diagnosis",
971
971
values= c(16, 16, 18)) +
972
972
scale_size_manual(name = "Diagnosis",
@@ -1006,7 +1006,7 @@ scaled <- ggplot(scaled_cancer, aes(x = Area,
1006
1006
size = Class)) +
1007
1007
geom_point(alpha = 0.6) +
1008
1008
scale_color_manual(name = "Diagnosis",
1009
- values = c("steelblue2 ", "orange2 ", "red")) +
1009
+ values = c("steelblue ", "darkorange ", "red")) +
1010
1010
scale_shape_manual(name = "Diagnosis",
1011
1011
values= c(16, 16, 18)) +
1012
1012
scale_size_manual(name = "Diagnosis",
@@ -1043,7 +1043,7 @@ ggplot(unscaled_cancer, aes(x = Area,
1043
1043
shape = Class)) +
1044
1044
geom_point(size = 2.5, alpha = 0.6) +
1045
1045
scale_color_manual(name = "Diagnosis",
1046
- values = c("steelblue2 ", "orange2 ", "red")) +
1046
+ values = c("steelblue ", "darkorange ", "red")) +
1047
1047
scale_shape_manual(name = "Diagnosis",
1048
1048
values= c(16, 16, 18)) +
1049
1049
scale_size_manual(name = "Diagnosis",
@@ -1115,7 +1115,7 @@ rare_plot <- rare_cancer |>
1115
1115
labs(x = "Perimeter (standardized)",
1116
1116
y = "Concavity (standardized)",
1117
1117
color = "Diagnosis") +
1118
- scale_color_manual(values = c("orange2 ", "steelblue2 ")) +
1118
+ scale_color_manual(values = c("darkorange ", "steelblue ")) +
1119
1119
theme(text = element_text(size = 12))
1120
1120
1121
1121
rare_plot
@@ -1148,16 +1148,16 @@ rare_plot <- bind_rows(rare_cancer,
1148
1148
x = "Perimeter (standardized)",
1149
1149
y = "Concavity (standardized)") +
1150
1150
scale_color_manual(name = "Diagnosis",
1151
- values = c("steelblue2 ", "orange2 ", "red")) +
1151
+ values = c("steelblue ", "darkorange ", "red")) +
1152
1152
scale_shape_manual(name = "Diagnosis",
1153
1153
values= c(16, 16, 18))+
1154
1154
scale_size_manual(name = "Diagnosis",
1155
1155
values= c(2, 2, 2.5))
1156
1156
1157
1157
for (i in 1:7) {
1158
- clr <- "steelblue2 "
1158
+ clr <- "steelblue "
1159
1159
if (neighbors$Class[i] == "Malignant") {
1160
- clr <- "orange2 "
1160
+ clr <- "darkorange "
1161
1161
}
1162
1162
rare_plot <- rare_plot +
1163
1163
geom_segment(
@@ -1217,7 +1217,7 @@ rare_plot <-
1217
1217
labs(color = "Diagnosis",
1218
1218
x = "Perimeter (standardized)",
1219
1219
y = "Concavity (standardized)") +
1220
- scale_color_manual(values = c("orange2 ", "steelblue2 "))
1220
+ scale_color_manual(values = c("darkorange ", "steelblue "))
1221
1221
1222
1222
rare_plot
1223
1223
```
@@ -1288,7 +1288,7 @@ upsampled_plot <-
1288
1288
labs(color = "Diagnosis",
1289
1289
x = "Perimeter (standardized)",
1290
1290
y = "Concavity (standardized)") +
1291
- scale_color_manual(values = c("orange2 ", "steelblue2 "))
1291
+ scale_color_manual(values = c("darkorange ", "steelblue "))
1292
1292
1293
1293
upsampled_plot
1294
1294
```
@@ -1492,7 +1492,7 @@ wkflw_plot <-
1492
1492
labs(color = "Diagnosis",
1493
1493
x = "Area",
1494
1494
y = "Smoothness") +
1495
- scale_color_manual(values = c("orange2 ", "steelblue2 ")) +
1495
+ scale_color_manual(values = c("darkorange ", "steelblue ")) +
1496
1496
theme(text = element_text(size = 12))
1497
1497
1498
1498
wkflw_plot
0 commit comments