set.seed(123)
mat <- matrix(rnorm(72), nrow = 8)
# used in the layout, define the default action for all plots in the layout
ggheatmap(mat) -
scheme_align(guides = NULL) +
anno_right() +
align_dendro(aes(color = branch), k = 3)
# You can also add it for a single plot
ggheatmap(mat) -
# for all plots in the layout, we default won't collect any guide legends
scheme_align(guides = NULL) +
# for the heatmap body, we collect guide legends in the right
# note, the guide legends will be collected to the right side of the
# layout which will overlap the legends in the right annotation
scheme_align(guides = "r") +
anno_right() +
align_dendro(aes(color = branch), k = 3)
# to avoid overlapping, we can also collect the guide legends in the
# right annotation
ggheatmap(mat) -
scheme_align(guides = NULL) +
scheme_align(guides = "r") +
anno_right() +
align_dendro(aes(color = branch), k = 3) +
scheme_align(guides = "r")
Run the code above in your browser using DataLab