Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a heatmap with a large matrix?

Tags:

r

heatmap

I have a 1000*1000 matrix (which only includes integer 0 and 1), but when I tried to make a heatmap, an error occurs because it is too large.

How can I create a heatmap with such a large matrix?

like image 851
question Avatar asked Apr 14 '11 17:04

question


People also ask

How do you create a heatmap matrix?

Create a matrix of data. Then create a heatmap of the matrix values. Use custom labels along the x-axis and y-axis by specifying the first two input arguments as the labels you want. Specify the title and axis labels by setting properties of the HeatmapChart object.

Is a heatmap a matrix?

Heatmap (Matrix) Heatmaps visualise data through variations in colouring. When applied to a tabular format, Heatmaps are useful for cross-examining multivariate data, through placing variables in the rows and columns and colouring the cells within the table.

What is the main limitation of a heatmap?

Too many diverse interpretations. Gives an indication of the items that users click on. This would indicate what the users find interesting but not what grabs their attention but they don't end up clicking on for whatever reasons.


1 Answers

I can believe that the heatmap is, at least, taking a long time, because heatmap does a lot of fancy stuff that takes extra time and memory. Using dat from @bill_080's example:

## basic command: 66 seconds
t0 <- system.time(heatmap(dat))
## don't reorder rows & columns: 43 seconds
t1 <- system.time(heatmap(dat,Rowv=NA))
## remove most fancy stuff (from ?heatmap): 14 seconds
t2 <- system.time( heatmap(dat, Rowv = NA, Colv = NA, scale="column",
             main = "heatmap(*, NA, NA) ~= image(t(x))"))
## image only: 13 seconds
t3  <- system.time(image(dat))
## image using raster capability in R 2.13.0: 1.2 seconds
t4 <- system.time(image(dat,useRaster=TRUE))

You might want to consider what you really want out of the heatmap -- i.e., do you need the fancy dendrogram/reordering stuff?

like image 87
Ben Bolker Avatar answered Oct 17 '22 08:10

Ben Bolker