Closed teunbrand closed 3 years ago
This is now possible:
library(ggh4x)
#> Loading required package: ggplot2
clust <- hclust(dist(USArrests), "ave")
df <- data.frame(
State = rownames(USArrests)[row(USArrests)],
variable = colnames(USArrests)[col(USArrests)],
value = unname(do.call(c, USArrests))
)
p <- ggplot(df, aes(variable, State, fill = value)) +
geom_raster()
# Plotting without labels
p + scale_y_dendrogram(hclust = clust, labels = NULL)
# Setting scale labels to NULL is not useful if you want them at the other side
p + scale_y_dendrogram(hclust = clust, labels = NULL) +
guides(y.sec = guide_axis())
# The solution would be to set `label = FALSE` in the guide itself.
p + scale_y_dendrogram(hclust = clust, guide = guide_dendro(label = FALSE)) +
guides(y.sec = guide_axis())
Created on 2021-01-07 by the reprex package (v0.3.0)
Convenient if you want to use a secondary discrete axis for labeling. Control at the scale level would also propagate to the secondary axis.