Questions tagged [pheatmap]

A package for drawing pretty heatmaps in R.

pheatmap is a package for drawing pretty heatmaps in R. The ordinary heatmap function in R has several drawbacks when it comes to producing publication quality heatmaps. It is hard to produce pictures with consistent text, cell and overall sizes and shapes. The function pheatmap() tries to alleviate the problems by offering more fine grained control over heatmap dimensions and appearance.

Repositories

Resources

223 questions
19
votes
2 answers

Set 0-point for pheatmap in R

How can you set the 0-point on the color scale to white in this heatmap? Does it use the breaks parameter? In the following code, white is set to 3 (or nearby on the scale): test = matrix(rnorm(200), 20, 10) test[1:10, seq(1, 10, 2)] = test[1:10,…
Megatron
  • 15,909
  • 12
  • 89
  • 97
16
votes
3 answers

Pheatmap annotation colors and border

Pheatmap library(pheatmap) takes annotation_colorsto add the header ID colors on the top of each heatmap column. I want to add white as column header color with borders. Border can be added by border_color but this function draws borders also to…
Al14
  • 1,734
  • 6
  • 32
  • 55
14
votes
5 answers

pheatmap: Color for NA

Using R package pheatmap to draw heatmaps. Is there a way to assign a color to NAs in the input matrix? It seems NA gets colored in white by default. E.g.: library(pheatmap) m<- matrix(c(1:100), nrow= 10) m[1,1]<- NA m[10,10]<- NA pheatmap(m,…
dariober
  • 8,240
  • 3
  • 30
  • 47
10
votes
1 answer

R pheatmap: change annotation colors and prevent graphics window from popping up

Following up on this question, I found the pheatmap function (which offers me a lot more control on the stuff that I want to do than heatmap.2). I have 2 problems though: 1- I cannot change the colors of the annotation (categories) 2- The graphics…
DaniCee
  • 2,397
  • 6
  • 36
  • 59
10
votes
1 answer

Using a pheatmap in arrangeGrob

I'm attempting to plate two plots in the same .jpg using arrangeGrob(). I've only just started learning about grids and grobs and I think I know what the problem is: pheatmap is a grid object and containing grob objects, not allowing me to put it in…
Xizam
  • 699
  • 7
  • 21
9
votes
2 answers

Define specific value colouring with pheatmap in R

Let's say: m1<-matrix(rnorm(1000),ncol=100) and defining colours: cols = colorRampPalette(c("white", "red"))(30) I am producing a heatmap without clustering with pheatmap function: pheatmap(dist(t(m1)), cluster_rows = F, cluster_cols = F,…
Kwnwps
  • 353
  • 1
  • 4
  • 15
8
votes
3 answers

R - Legend title or units when using Pheatmap

I am using pheatmap to create a heatmap of values and would like to label the legend with the units of the z values in the matrix. In this example I would like the top of the legend to say Temperature [°C]. I have read the guidelines here for…
alkey
  • 986
  • 4
  • 16
  • 33
7
votes
1 answer

How can you show the rownames in pheatmap on the left side of the graph?

I am making a heatmap using the pheatmap package in R. By default the rownames are shown on the right side of the heatmap. Does anyone know how to move them to the left side? Some other packages seem to have functions for this, like row_names_side =…
Koalabear
  • 110
  • 1
  • 6
7
votes
1 answer

Partial Row Labels Heatmap - R

I was wondering if anyone knows of a package that allows partial row labeling of heatmaps. I am currently using pheatmap() to construct my heatmaps, but I can use any package that has this functionality. I have plots with many rows of…
Qwfqwf
  • 483
  • 3
  • 9
7
votes
0 answers

Change axis labels rotation of a heatmap generated by package pheatmap

The x-axis labels of heatmaps produced by package pheatmap are 270 degrees rotated by default. I need to make them 90 degrees rotated. I have traced the pheatmap() function and see there is an internal (invisible) function that produces…
Ali
  • 9,440
  • 12
  • 62
  • 92
6
votes
1 answer

No border color in "pheatmap" in R

I am exploring R to analyze my gene expression data. I could create a pretty heatmap using the pheatmap package. However, while transitioning between different colored boxes, it automatically introduces a border color which I can see after zooming…
Abhishek Parab
  • 215
  • 2
  • 11
5
votes
1 answer

order pheatmap by annotation

I am attempting to make a figure using the package pheatmap. I would like to group the data by the annotation that I am using, but it won't group together. My data is here: sub_samp <- structure(c(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,…
El David
  • 375
  • 2
  • 3
  • 11
5
votes
1 answer

Something weird in pheatmap (a bug?)

Reproducible Data: data(crabs, package = "MASS") df <- crabs[-(1:3)] set.seed(12345) df$GRP <- kmeans(df, 4)$cluster df.order <- dplyr::arrange(df, GRP) Data Description: df has 5 numerical variables. I did the K-means algorithm according to these…
Darren Tsai
  • 32,117
  • 5
  • 21
  • 51
5
votes
2 answers

Merging multiple hclust objects (or dendrograms)

Is there an easy way to merge multiple hclust objects (or dendrograms) at the root? I've made the example as complete as possible to illustrate my problem. Let's say I'd like to cluster USArrests by region and then unite all the hclust objects to…
csgroen
  • 2,511
  • 11
  • 28
5
votes
3 answers

Column labels cropped when using pheatmap

I am plotting a heatmap using pheatmap (Documentation). I am plotting a matrix in a fairly straightforward way: pheatmap(mat, annotation_col=df, labels_col=rld$Infection_Line, fontsize_row=5, fontsize_col=7) The bottom of my plot is getting cut…
Adam Price
  • 810
  • 2
  • 11
  • 21
1
2 3
14 15