|
|
@ -0,0 +1,14 @@ |
|
|
|
ggheatmap<-function(df, x=NULL, y=NULL, value=NULL){ |
|
|
|
if (is.null(x)){x=colnames(df)[1]} |
|
|
|
if (is.null(y)){y=colnames(df)[2]} |
|
|
|
if (is.null(value)){value=colnames(df)[3]} |
|
|
|
|
|
|
|
order<-clustsort(df %>% spread(y,value)) |
|
|
|
|
|
|
|
df %>% |
|
|
|
ggplot(aes(df[,x], df[,y], fill=df[,value]))+ |
|
|
|
scale_x_discrete(limits=order$x)+ |
|
|
|
scale_y_discrete(limits=order$y)+ |
|
|
|
labs(x=x, y=y)+ |
|
|
|
theme_heatmap() |
|
|
|
} |