Skip to content

Commit 1cedf29

Browse files
improved first few figures in clustering; more consistent style with remainder of chp
1 parent 3810cb6 commit 1cedf29

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/clustering.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ toy_example_clus1_center = alt.layer(
352352
x=alt.X("flipper_length_standardized"),
353353
y=alt.Y("bill_length_standardized")
354354
),
355-
alt.Chart(clus).mark_circle(color='coral', size=500, opacity=1).encode(
355+
alt.Chart(clus).mark_circle(color='steelblue', size=300, opacity=1, stroke='black').encode(
356356
x=alt.X("mean(flipper_length_standardized)")
357357
.scale(zero=False, padding=20)
358358
.title("Flipper Length (standardized)"),
@@ -373,7 +373,7 @@ in {numref}`toy-example-clus1-center`
373373
:figwidth: 700px
374374
:name: toy-example-clus1-center
375375

376-
Cluster 0 from the `penguins_standardized` data set example. Observations are in blue, with the cluster center highlighted in orange.
376+
Cluster 0 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.
377377
:::
378378

379379
```{code-cell} ipython3
@@ -417,7 +417,7 @@ These distances are denoted by lines in {numref}`toy-example-clus1-dists` for th
417417
:figwidth: 700px
418418
:name: toy-example-clus1-dists
419419

420-
Cluster 0 from the `penguins_standardized` data set example. Observations are in blue, with the cluster center highlighted in orange. The distances from the observations to the cluster center are represented as black lines.
420+
Cluster 0 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.
421421
:::
422422

423423
```{code-cell} ipython3
@@ -440,14 +440,15 @@ toy_example_all_clus_dists = alt.layer(
440440
alt.Y("bill_length_standardized"),
441441
alt.Color('cluster:N')
442442
),
443-
alt.Chart(penguins_clustered).mark_circle(color='coral', size=200, opacity=1).encode(
443+
alt.Chart(penguins_clustered).mark_circle(size=200, opacity=1, stroke = "black").encode(
444444
alt.X("mean(flipper_length_standardized)")
445445
.scale(zero=False)
446446
.title("Flipper Length (standardized)"),
447447
alt.Y("mean(bill_length_standardized)")
448448
.scale(zero=False)
449449
.title("Bill Length (standardized)"),
450-
alt.Detail('cluster:N')
450+
alt.Detail('cluster:N'),
451+
alt.Color('cluster:N')
451452
)
452453
)
453454
glue('toy-example-all-clus-dists', toy_example_all_clus_dists, display=True)
@@ -468,7 +469,7 @@ These distances are denoted by black lines in
468469
:figwidth: 700px
469470
:name: toy-example-all-clus-dists
470471

471-
All clusters from the `penguins_standardized` data set example. Observations are in blue, orange, and red with the cluster center highlighted in orange. The distances from the observations to each of the respective cluster centers are represented as black lines.
472+
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.
472473
:::
473474

474475
Since K-means uses the straight-line distance to measure the quality of a clustering,

0 commit comments

Comments
 (0)