draw_heatmap {tinyarray} | R Documentation |
draw a heatmap plot
Description
warning a heatmap plot for expression matrix and group by group_list praramter, exp will be scaled.
Usage
draw_heatmap(
n,
group_list,
scale_before = FALSE,
n_cutoff = 3,
legend = FALSE,
show_rownames = FALSE,
annotation_legend = FALSE,
split_column = FALSE,
show_column_title = FALSE,
color = (grDevices::colorRampPalette(c("#2fa1dd", "white", "#f87669")))(100),
color_an = c("#2fa1dd", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582",
"#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494",
"#B3B3B3"),
scale = TRUE,
main = NA,
...
)
Arguments
n |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
scale_before |
deprecated parameter |
n_cutoff |
3 by defalut , scale before plot and set a cutoff,usually 2 or 1.6 |
legend |
logical,show legend or not |
show_rownames |
logical,show rownames or not |
annotation_legend |
logical,show annotation legend or not |
split_column |
split column by group_list |
show_column_title |
show column title or not |
color |
color for heatmap |
color_an |
color for column annotation |
scale |
logical,scale the matrix or not |
main |
the title of the plot |
... |
other parameters from pheatmap |
Value
a heatmap plot according to exp
and grouped by group
.
Author(s)
Xiaojie Sun
See Also
draw_pca
;draw_volcano
;draw_venn
Examples
#example data
exp = matrix(abs(rnorm(60,sd = 16)),nrow = 10)
exp[,4:6] <- exp[,4:6]+20
colnames(exp) <- paste0("sample",1:6)
rownames(exp) <- paste0("gene",1:10)
exp[1:4,1:4]
group_list = factor(rep(c("A","B"),each = 3))
if(requireNamespace("ggplotify",quietly = TRUE)){
draw_heatmap(exp,group_list)
#use iris
n = t(iris[,1:4]);colnames(n) = 1:150
group_list = iris$Species
draw_heatmap(n,group_list)
draw_heatmap(n,group_list,color = colorRampPalette(c("green","black","red"))(100),
color_an = c("red","blue","pink") )
}else{
warning("Package 'ggplotify' needed for this function to work.
Please install it by install.packages('ggplotify')")
}
[Package tinyarray version 2.4.2 Index]