Skip to content

Commit 2363658

Browse files
committed
adjusting size of plots and fonts
1 parent 626d180 commit 2363658

File tree

7 files changed

+36
-26
lines changed

7 files changed

+36
-26
lines changed

classification1.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ ggplot(unscaled_cancer, aes(x = Area,
10611061
facet_zoom(x = ( Area > 380 & Area < 420) ,
10621062
y = (Smoothness > 0.08 & Smoothness < 0.14), zoom.size = 2) +
10631063
theme_bw() +
1064-
theme(text = element_text(size = 12), legend.position="bottom")
1064+
theme(text = element_text(size = 18), axis.title=element_text(size=18), legend.position="bottom")
10651065
```
10661066

10671067
### Balancing

classification2.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ plt_irrelevant_accuracies <- ggplot(res) +
11101110
geom_line(mapping = aes(x=ks, y=accs)) +
11111111
labs(x = "Number of Irrelevant Predictors",
11121112
y = "Model Accuracy Estimate") +
1113-
theme(text = element_text(size = 16), axis.title=element_text(size=16))
1113+
theme(text = element_text(size = 18), axis.title=element_text(size=18))
11141114
11151115
plt_irrelevant_accuracies
11161116
```
@@ -1131,7 +1131,7 @@ plt_irrelevant_nghbrs <- ggplot(res) +
11311131
geom_line(mapping = aes(x=ks, y=nghbrs)) +
11321132
labs(x = "Number of Irrelevant Predictors",
11331133
y = "Number of neighbors") +
1134-
theme(text = element_text(size = 16), axis.title=element_text(size=16))
1134+
theme(text = element_text(size = 18), axis.title=element_text(size=18))
11351135
11361136
plt_irrelevant_nghbrs
11371137
```
@@ -1145,7 +1145,7 @@ plt_irrelevant_nghbrs <- ggplot(res_tmp) +
11451145
geom_line(mapping = aes(x=ks, y=accuracy, color=Type)) +
11461146
labs(x = "Number of Irrelevant Predictors", y = "Accuracy") +
11471147
scale_color_discrete(labels= c("Tuned K", "K = 3")) +
1148-
theme(text = element_text(size = 16), axis.title=element_text(size=16))
1148+
theme(text = element_text(size = 17), axis.title=element_text(size=17))
11491149
11501150
plt_irrelevant_nghbrs
11511151
```
@@ -1378,7 +1378,7 @@ fwd_sel_accuracies_plot <- accuracies |>
13781378
ggplot(aes(x = size, y = accuracy)) +
13791379
geom_line() +
13801380
labs(x = "Number of Predictors", y = "Estimated Accuracy") +
1381-
theme(text = element_text(size = 18), axis.title=element_text(size=18))
1381+
theme(text = element_text(size = 20), axis.title=element_text(size=20))
13821382
13831383
fwd_sel_accuracies_plot
13841384
```

clustering.Rmd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ for (i in 1:4) {
473473
color = "black",
474474
fill = cbpalette) +
475475
annotate("text", x = -0.5, y = 1.5, label = paste0("Iteration ", i), size = 5)+
476-
theme(text = element_text(size = 12))
476+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
477477
478478
if (i == 1 | i == 2) {
479479
plt_ctr <- plt_ctr +
@@ -506,8 +506,8 @@ for (i in 1:4) {
506506
stroke = 1,
507507
color = "black",
508508
fill = cbpalette) +
509-
annotate("text", x = -0.5, y = 1.5, label = paste0("Iteration ", i), size = 5)+
510-
theme(text = element_text(size = 12))
509+
annotate("text", x = -0.5, y = 1.5, label = paste0("Iteration ", i), size = 5) +
510+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
511511
512512
if (i == 1 | i ==2) {
513513
plt_lbl <- plt_lbl +
@@ -646,7 +646,7 @@ for (i in 1:5) {
646646
color = "black",
647647
fill = cbpalette) +
648648
annotate("text", x = -0.5, y = 1.5, label = paste0("Iteration ", i), size = 5) +
649-
theme(text = element_text(size = 12))
649+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
650650
651651
if (i == 1 | i == 2) {
652652
plt_ctr <- plt_ctr +
@@ -679,7 +679,7 @@ for (i in 1:5) {
679679
color = "black",
680680
fill = cbpalette) +
681681
annotate("text", x = -0.5, y = 1.5, label = paste0("Iteration ", i), size = 5) +
682-
theme(text = element_text(size = 12))
682+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
683683
684684
if (i == 1 | i == 2) {
685685
plt_lbl <- plt_lbl +
@@ -729,15 +729,15 @@ ggarrange(iter_plot_list[[1]] +
729729
theme(axis.text.x = element_blank(),
730730
axis.ticks.x = element_blank(),
731731
axis.title.x = element_blank(),
732-
plot.margin = margin(r = 2, t = 2, b = 1)),
732+
plot.margin = margin(r = 2, t = 2, b = 2)),
733733
iter_plot_list[[6]] +
734734
theme(axis.text.y = element_blank(),
735735
axis.ticks.y = element_blank(),
736736
axis.title.y = element_blank(),
737737
axis.text.x = element_blank(),
738738
axis.ticks.x = element_blank(),
739739
axis.title.x = element_blank(),
740-
plot.margin = margin(r = 2, l = 2, t = 2, b = 1) ),
740+
plot.margin = margin(r = 2, l = 2, t = 2, b = 2) ),
741741
iter_plot_list[[7]] +
742742
theme(axis.text.y = element_blank(),
743743
axis.ticks.y = element_blank(),
@@ -826,7 +826,9 @@ p1 <- ggplot(assignments, aes(flipper_length_standardized,
826826
size = 5,
827827
shape = 21,
828828
stroke = 1) +
829-
scale_fill_manual(values = cbbPalette)
829+
scale_fill_manual(values = cbbPalette) +
830+
theme(text = element_text(size = 12), axis.title=element_text(size=12))
831+
830832
831833
p1
832834
```

inference.Rmd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ annotated_sampling_dist_20 <- sampling_distribution_20 +
557557
hjust = 1,
558558
vjust = 1,
559559
label = paste("mean = ", round(mean(sample_estimates$sample_mean), 1))
560-
)
560+
)+ theme(text = element_text(size = 12), axis.title=element_text(size=12))
561561
#+
562562
# annotate("text", x = max_x(sampling_distribution_20), y = max_count(sampling_distribution_20), hjust = 1, vjust = 3,
563563
# label = paste("sd = ", round(sd(sample_estimates$sample_mean), 1)))
@@ -571,7 +571,7 @@ annotated_sampling_dist_50 <- sampling_distribution_50 +
571571
hjust = 1,
572572
vjust = 1,
573573
label = paste("mean = ", round(mean(sample_estimates_50$sample_mean), 1))
574-
) #+
574+
)+ theme(text = element_text(size = 12), axis.title=element_text(size=12)) #+
575575
# annotate("text", x = max_x(sampling_distribution_20), y = max_count(sampling_distribution_50), hjust = 1, vjust = 3,
576576
# label = paste("sd = ", round(sd(sample_estimates_50$sample_mean), 1)))
577577
@@ -583,7 +583,7 @@ annotated_sampling_dist_100 <- sampling_distribution_100 +
583583
hjust = 1,
584584
vjust = 1,
585585
label = paste("mean = ", round(mean(sample_estimates_100$sample_mean), 1))
586-
) #+
586+
) + theme(text = element_text(size = 12), axis.title=element_text(size=12)) #+
587587
# annotate("text", x = max_x(sampling_distribution_20), y = max_count(sampling_distribution_100), hjust = 1, vjust = 3,
588588
# label = paste("sd = ", round(sd(sample_estimates_100$sample_mean), 1)))
589589
@@ -595,7 +595,8 @@ annotated_sampling_dist_500 <- sampling_distribution_500 +
595595
hjust = 1,
596596
vjust = 1,
597597
label = paste("mean = ", round(mean(sample_estimates_500$sample_mean), 1))
598-
) #+
598+
) + theme(text = element_text(size = 12), axis.title=element_text(size=12))
599+
#+
599600
# annotate("text", x = max_x(sampling_distribution_20), y = max_count(sampling_distribution_500), hjust = 1, vjust = 3,
600601
# label = paste("sd = ", round(sd(sample_estimates_500$sample_mean), 1)))
601602

regression1.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ For each model, we predict prices for the range of possible home sizes we
497497
observed in the data set (here 500 to 5,000 square feet) and we plot the
498498
predicted prices as a blue line.
499499

500-
```{r 07-howK, echo = FALSE, warning = FALSE, fig.height = 12, fig.width = 10,fig.cap = "Predicted values for house price (represented as a blue line) from KNN regression models for six different values for $K$."}
500+
```{r 07-howK, echo = FALSE, warning = FALSE, fig.height = 13, fig.width = 10,fig.cap = "Predicted values for house price (represented as a blue line) from KNN regression models for six different values for $K$."}
501501
gridvals <- c(1, 3, kmin, 41, 250, 932)
502502
503503
plots <- list()

regression2.Rmd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ simple linear regression model predictions for the Sacramento real estate data
327327
(predicting price from house size) and the "best" KNN regression model
328328
obtained from the same problem, shown in Figure \@ref(fig:08-compareRegression).
329329

330-
```{r 08-compareRegression, echo = FALSE, warning = FALSE, message = FALSE, fig.height = 4, fig.width = 10, fig.cap = "Comparison of simple linear regression and KNN regression."}
330+
```{r 08-compareRegression, echo = FALSE, warning = FALSE, message = FALSE, fig.height = 4.75, fig.width = 10, fig.cap = "Comparison of simple linear regression and KNN regression."}
331331
set.seed(1234)
332332
sacr_spec <- nearest_neighbor(weight_func = "rectangular", neighbors = 30) |>
333333
set_engine("kknn") |>
@@ -371,8 +371,10 @@ knn_plot_final <- ggplot(sacr_preds, aes(x = sqft, y = price)) +
371371
geom_line(data = sacr_preds, aes(x = sqft, y = .pred), color = "blue") +
372372
ggtitle("KNN regression") +
373373
annotate("text", x = 3500, y = 100000, label = paste("RMSPE =", sacr_rmspe)) +
374-
theme(text = element_text(size = 12))
374+
theme(text = element_text(size = 18), axis.title=element_text(size=18))
375+
375376
377+
376378
lm_rmspe <- lm_test_results |>
377379
filter(.metric == "rmse") |>
378380
pull(.estimate) |>
@@ -381,7 +383,7 @@ lm_rmspe <- lm_test_results |>
381383
lm_plot_final <- lm_plot_final +
382384
annotate("text", x = 3500, y = 100000, label = paste("RMSPE =", lm_rmspe)) +
383385
ggtitle("linear regression") +
384-
theme(text = element_text(size = 12))
386+
theme(text = element_text(size = 18), axis.title=element_text(size=18))
385387
386388
grid.arrange(lm_plot_final, knn_plot_final, ncol = 2)
387389
```

viz.Rmd

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,8 @@ morley_hist_default <- ggplot(morley_rel,
12381238
y = "# Measurements",
12391239
fill = "Experiment ID") +
12401240
theme(legend.position = "none") +
1241-
ggtitle("Default bin width (bins = 30)")
1241+
ggtitle("Default (bins = 30)") +
1242+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
12421243
12431244
morley_hist_big <- ggplot(morley_rel,
12441245
aes(x = relative_accuracy,
@@ -1250,7 +1251,8 @@ morley_hist_big <- ggplot(morley_rel,
12501251
y = "# Measurements",
12511252
fill = "Experiment ID") +
12521253
theme(legend.position = "none") +
1253-
ggtitle( "binwidth = 0.1")
1254+
ggtitle( "binwidth = 0.1") +
1255+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
12541256
12551257
morley_hist_med <- ggplot(morley_rel,
12561258
aes(x = relative_accuracy,
@@ -1262,7 +1264,8 @@ morley_hist_med <- ggplot(morley_rel,
12621264
y = "# Measurements",
12631265
fill = "Experiment ID") +
12641266
theme(legend.position = "none") +
1265-
ggtitle("binwidth = 0.01")
1267+
ggtitle("binwidth = 0.01") +
1268+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
12661269
12671270
morley_hist_small <- ggplot(morley_rel,
12681271
aes(x = relative_accuracy,
@@ -1274,7 +1277,8 @@ morley_hist_small <- ggplot(morley_rel,
12741277
y = "# Measurements",
12751278
fill = "Experiment ID") +
12761279
theme(legend.position = "none") +
1277-
ggtitle("binwidth = 0.001")
1280+
ggtitle("binwidth = 0.001") +
1281+
theme(text = element_text(size = 14), axis.title=element_text(size=14))
12781282
12791283
plot_grid(morley_hist_default,
12801284
morley_hist_small,
@@ -1433,7 +1437,8 @@ library(svglite) # we need this to save SVG files
14331437
faithful_plot <- ggplot(data = faithful, aes(x = waiting, y = eruptions)) +
14341438
geom_point() +
14351439
labs(x = "Waiting time to next eruption \n (minutes)",
1436-
y = "Eruption time \n (minutes)")
1440+
y = "Eruption time \n (minutes)") +
1441+
theme(text = element_text(size = 12))
14371442
14381443
faithful_plot
14391444
```

0 commit comments

Comments
 (0)