overview.Rmd
## gene strain value
## 1 uhz strain1 0
## 2 ism strain1 1
## 3 gdr strain1 0
## 4 thb strain1 1
## 5 dgz strain1 1
## 6 cph strain1 1
d1_dat <- create_dend(example_dat, "gene", "strain") d2_dat <- create_dend(example_dat, "strain", "gene")
## [1] "You are beautiful!"
hm_dat <- mutate(example_dat, gene = factor(gene), gene = factor(gene, levels = levels(gene)[order.dendrogram(d1_dat)]), strain = factor(strain), strain = factor(strain, levels = levels(strain)[order.dendrogram(d2_dat)])) hm <- ggplot(hm_dat, aes(x = gene, y = strain, fill = factor(value))) + geom_tile(color = "black") + theme(legend.position = "right") hm
## [1] "Such a bedazzling heatmap!"
d1 <- plot_dendrogram(d1_dat) d2 <- plot_dendrogram(d2_dat) + coord_flip() d1 + d2
## [1] "Mm! This is just terrific!"
arrange_dendrogram(hm + theme_bw() + theme(legend.position = "bottom"), d1 + theme_void(), d2 + theme_void())
## [1] "You are great!"
arrange_dendrogram(hm + theme_bw() + theme(legend.position = "none"), d1 + theme_void(), d2 + theme_void(), top_right = get_legend(hm))
## [1] "Huh! This is just delightful!"
arrange_dendrogram(hm + theme_bw() + theme(legend.position = "bottom"), d1 + theme_void(), d2 + theme_void(), widths = c(0.9, 0.1), heights = c(0.1, 0.9))
## [1] "You are super!"
label_colors <- c(rep("red", 3), rep("blue", 2), "green") arrange_dendrogram(hm + theme_bw() + theme(legend.position = "bottom", axis.text.y = element_text(color = label_colors)), d1 + theme_void(), d2 + theme_void())
## [1] "AHA! You have done this calmly!"