Skip to content

Commit 3459daf

Browse files
committed
common legend for standardized nonstandardized plot
1 parent 73a2aa5 commit 3459daf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

classification1.Rmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ library(formatR)
55
library(plotly)
66
library(knitr)
77
library(kableExtra)
8+
library(ggpubr)
89
910
knitr::opts_chunk$set(echo = TRUE,
1011
fig.align = "center")
@@ -903,7 +904,7 @@ Standardizing your data should be a part of the preprocessing you do
903904
before predictive modeling and you should always think carefully about your problem domain and
904905
whether you need to standardize your data.
905906

906-
```{r 05-scaling-plt, echo = FALSE, fig.height = 4, fig.width = 10, fig.cap = "Comparison of K = 3 nearest neighbors with standardized and unstandardized data."}
907+
```{r 05-scaling-plt, echo = FALSE, fig.height = 4, fig.cap = "Comparison of K = 3 nearest neighbors with standardized and unstandardized data."}
907908
908909
attrs <- c("Area", "Smoothness")
909910
@@ -994,7 +995,8 @@ scaled <- ggplot(scaled_cancer, aes(x = Area,
994995
yend = unlist(neighbors_scaled[3, attrs[2]])
995996
), color = "black", size = 0.5)
996997
997-
gridExtra::grid.arrange(unscaled, scaled, ncol = 2)
998+
ggarrange(unscaled, scaled, ncol = 2, common.legend = TRUE, legend = "bottom")
999+
9981000
```
9991001

10001002
```{r 05-scaling-plt-zoomed, fig.height = 4, fig.width = 10, echo = FALSE, fig.cap = "Close up of three nearest neighbors for unstandardized data."}

0 commit comments

Comments
 (0)