Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dendrograms #34

Merged
merged 19 commits into from
Dec 8, 2024
Merged

Dendrograms #34

merged 19 commits into from
Dec 8, 2024

Conversation

teunbrand
Copy link
Owner

This PR aims to fix #33.

Examples of usage:

devtools::load_all("~/packages/legendry/")
#> ℹ Loading legendry
#> Loading required package: ggplot2
clust <- hclust(dist(scale(USArrests)), "ave")
var_clust <- hclust(dist(scale(t(USArrests))), "ave")

long_arrests <- data.frame(
  state = rownames(USArrests)[row(USArrests)],
  variable = colnames(USArrests)[col(USArrests)],
  value = as.vector(scale(USArrests))
)

ggplot(long_arrests, aes(variable, state, fill = value)) +
  geom_tile() +
  scale_y_dendro(clust) +
  scale_x_dendro(var_clust) +
  guides(
    x = "axis",
    x.sec = primitive_segments(key = "dendro")
  )

Created on 2024-12-08 with reprex v2.1.1

@teunbrand teunbrand merged commit dd9e060 into main Dec 8, 2024
7 checks passed
@teunbrand teunbrand deleted the dendrograms branch December 8, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dendrogram axes
1 participant