I want to edit row and col names in my pheatmap
or eventually delete and add new row and col names to be edited. In this case I will set show_colnames
and show_rownames
to FALSE
.
library("pheatmap")
pheatmap(scale(dat), show_colnames = T, show_rownames = T,legend = TRUE,
cluster_rows=F, cluster_cols=F, border_color = "grey60")
Can somebody help me thanks.
You can use labels_row
and labels_col
parameters.
> set.seed(1)
> mat <- matrix(rnorm(100), 10, 10, dimnames=list(letters[1:10], letters[11:20]))
> pheatmap(mat)
> pheatmap(mat, labels_row=paste0("foo", 1:10), labels_col=paste0("bar", 1:10))
Alternatively you can modify rownames
/ colnames
of the matrix you pass to the pheatmap
function.
library(magrittr)
mat %>%
set_rownames(paste0("foo", 1:10)) %>%
set_colnames(paste0("bar", 1:10)) %>%
pheatmap()