|
0
|
1 cluster_plot <- function(result){
|
|
|
2 library(ggdendro)
|
|
|
3 library(ggplot2)
|
|
|
4 hc=hclust(dist(as.matrix(rbind(result))))
|
|
|
5 cluster_plot=ggdendrogram(hc, theme_dendro = FALSE)+ labs(title="Cluster Dendrogram",x=NULL,y=NULL)
|
|
|
6 cluster_plot
|
|
|
7 }
|
|
|
8
|
|
|
9 bar_plot <- function(result){
|
|
|
10 library(ggplot2)
|
|
|
11 library(reshape2)
|
|
|
12 library(plyr)
|
|
|
13 df.m <- melt(result)
|
|
|
14 df.m <- rename(df.m, c(Var1 = "Sample", Var2 = "Cell_type"))
|
|
|
15 a <- ggplot(df.m,aes(x=Sample,y=value,fill=Cell_type))+labs(x=NULL, y="Cell %",fill = NULL,title = "Barplot")
|
|
|
16 bar_plot <- a + geom_bar(stat = "identity", position = "stack")
|
|
|
17 immigration_theme <- theme_update(axis.text.x = element_text(angle = 90))
|
|
|
18 bar_plot
|
|
|
19 }
|
|
|
20
|