I am trying to plot a pheatmap. However, unlike other plotting packages in R like ggplot, I am unable to find a option to add row labels and column labels. For example, in ggplot, I can add rowlab using ylab()
and column label using xlab()
.
Here is the minimum working example:
library(pheatmap)
library(reshape2)
df = data.frame(r = c(1:3), foo = c("a","b", "c"), val = c(5,10,15), stringsAsFactors = F)
heatmat = reshape2::acast(df, foo~r, fill = 0, value.var = "val")
# Create Heatmap
p <- pheatmap(heatmat)
The default result is as follows:
However, I want to have following plot:
Any suggestions how to add labels in the pheatmap?