Skip to content

Commit

Permalink
show code in hclust
Browse files Browse the repository at this point in the history
  • Loading branch information
dajmcdon committed Dec 3, 2021
1 parent 0d428cf commit 44819cc
Show file tree
Hide file tree
Showing 4 changed files with 1,136 additions and 284 deletions.
20 changes: 17 additions & 3 deletions _lecture-slides/28-hclust.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ g + geom_segment(aes(x=x,y=y,xend=xend,yend=yend),data = tff) +

## Centroid linkage

.pull-left[
Centroid linkage is

- ... quite intuitive
Expand All @@ -272,15 +273,28 @@ g1 = ggplot(circles,aes(x=x,y=y,color=as.factor(grp))) + geom_point() +
theme(legend.position = 'none')
```

.pull-left[

```{r, fig.width=3,fig.height=3,echo=FALSE,fig.align='center'}
g1
```
]

.pull-right[
```{r, fig.width=4, fig.height=4,echo=FALSE,fig.align='center'}
plot(hc)

```{r, echo=TRUE, eval=FALSE}
tt <- seq(0, 2*pi, len=50)
tt2 <- seq(0, 2*pi, len=75)
c1 <- tibble(x = cos(tt), y = sin(tt))
c2 <- tibble(x = 1.5 * cos(tt2), y = 1.5 * sin(tt2))
circles <- bind_rows(c1, c2)
di <- dist(circles[,1:2])
hc <- hclust(di, method = "centroid")
```


```{r, fig.width=4, fig.height=4,echo=TRUE,fig.align='center'}
par(mar = c(.1,5,3,.1))
plot(hc, xlab="")
```
]

Expand Down
32 changes: 26 additions & 6 deletions schedule/28-hclust.html

Large diffs are not rendered by default.

Loading

0 comments on commit 44819cc

Please sign in to comment.