Skip to content

Commit b523442

Browse files
consistent cluster centre style in clustering
1 parent c08434c commit b523442

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

source/clustering.Rmd

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ In the first cluster from the example, there are `r nrow(clus1)` data points. Th
308308
(standardized flipper length `r round(mean(clus1$flipper_length_standardized),2)`, standardized bill length `r round(mean(clus1$bill_length_standardized),2)`) highlighted
309309
in Figure \@ref(fig:10-toy-example-clus1-center).
310310

311-
(ref:10-toy-example-clus1-center) Cluster 1 from the `penguins_standardized` data set example. Observations are in blue, with the cluster center highlighted in red.
311+
(ref:10-toy-example-clus1-center) Cluster 1 from the `penguins_standardized` data set example. Observations are small blue points, with the cluster center highlighted as a large blue point with a black outline.
312312

313313
```{r 10-toy-example-clus1-center, echo = FALSE, warning = FALSE, fig.height = 3.25, fig.width = 3.5, fig.align = "center", fig.cap = "(ref:10-toy-example-clus1-center)"}
314314
base <- ggplot(penguins_clustered, aes(x = flipper_length_standardized, y = bill_length_standardized)) +
@@ -334,8 +334,11 @@ base <- ggplot(clus1) +
334334
)) +
335335
geom_point(aes(y = mean(bill_length_standardized),
336336
x = mean(flipper_length_standardized)),
337-
color = "#F8766D",
338-
size = 5) +
337+
size = 4,
338+
shape = 21,
339+
stroke = 1,
340+
color = "black",
341+
fill = "dodgerblue3")+
339342
theme(legend.position = "none")
340343
341344
base
@@ -354,7 +357,7 @@ S^2 = \left((x_1 - \mu_x)^2 + (y_1 - \mu_y)^2\right) + \left((x_2 - \mu_x)^2 + (
354357

355358
These distances are denoted by lines in Figure \@ref(fig:10-toy-example-clus1-dists) for the first cluster of the penguin data example.
356359

357-
(ref:10-toy-example-clus1-dists) Cluster 1 from the `penguins_standardized` data set example. Observations are in blue, with the cluster center highlighted in red. The distances from the observations to the cluster center are represented as black lines.
360+
(ref:10-toy-example-clus1-dists) Cluster 1 from the `penguins_standardized` data set example. Observations are small blue points, with the cluster center highlighted as a large blue point with a black outline. The distances from the observations to the cluster center are represented as black lines.
358361

359362
```{r 10-toy-example-clus1-dists, echo = FALSE, warning = FALSE, fig.height = 3.25, fig.width = 3.5, fig.align = "center", fig.cap = "(ref:10-toy-example-clus1-dists)"}
360363
base <- ggplot(clus1)
@@ -373,8 +376,11 @@ for (i in 1:nrow(clus1)) {
373376
base <- base +
374377
geom_point(aes(y = mean(bill_length_standardized),
375378
x = mean(flipper_length_standardized)),
376-
color = "#F8766D",
377-
size = 5)
379+
size = 4,
380+
shape = 21,
381+
stroke = 1,
382+
color = "black",
383+
fill = "dodgerblue3")
378384
379385
base <- base +
380386
geom_point(aes(y = bill_length_standardized,
@@ -397,7 +403,7 @@ this means adding up all the squared distances for the 18 observations.
397403
These distances are denoted by black lines in
398404
Figure \@ref(fig:10-toy-example-all-clus-dists).
399405

400-
(ref:10-toy-example-all-clus-dists) All clusters from the `penguins_standardized` data set example. Observations are in orange, blue, and yellow with the cluster center highlighted in red. The distances from the observations to each of the respective cluster centers are represented as black lines.
406+
(ref:10-toy-example-all-clus-dists) All clusters from the `penguins_standardized` data set example. Observations are small orange, blue, and yellow points with cluster centers denoted by larger points with a black outline. The distances from the observations to each of the respective cluster centers are represented as black lines.
401407

402408
```{r 10-toy-example-all-clus-dists, echo = FALSE, warning = FALSE, fig.height = 3.25, fig.width = 4.25, fig.align = "center", fig.cap = "(ref:10-toy-example-all-clus-dists)"}
403409
all_clusters_base <- ggplot(penguins_clustered)
@@ -441,13 +447,13 @@ all_clusters_base <- all_clusters_base +
441447
all_clusters_base <- all_clusters_base +
442448
geom_point(aes(y = cluster_centers$y[1],
443449
x = cluster_centers$x[1]),
444-
color = "#F8766D", size = 3) +
450+
color = "black", fill = "darkorange3", size = 4, stroke = 1, shape = 21) +
445451
geom_point(aes(y = cluster_centers$y[2],
446452
x = cluster_centers$x[2]),
447-
color = "#F8766D", size = 3) +
453+
color = "black", fill = "dodgerblue3", size = 4, stroke = 1, shape = 21) +
448454
geom_point(aes(y = cluster_centers$y[3],
449455
x = cluster_centers$x[3]),
450-
color = "#F8766D", size = 3)
456+
color = "black", fill = "goldenrod1", size = 4, stroke = 1, shape = 21)
451457
452458
all_clusters_base
453459
```

0 commit comments

Comments
 (0)