开发者

Heatmap generation

I have an Excel file with two different columns. One column have values ranging from 2 to 15 and other column have values 开发者_运维知识库ranging from positive to negative numbers.

I want to produce a heatmap in such a way that for first column each value should have a different color. Second column should be in the form of a gradient.

I tried using excel conditional formatting to do this.

But I want to know is there any way to do it in R?


The R command image() takes a matrix and makes a heat-map from it. see the help page: ?image. Also worth considering is the heatmap function, which is basically image() with some clustering applied. Below are two examples from these two plotting routines:

image(volcano,col = terrain.colors(30))
heatmap(volcano,col = terrain.colors(30))

Probably the easiest way to export your data from Excel to R is to save it as a .csv file (comma or tab-separated text file), and then import it using read.table()

Heatmap generation

Heatmap generation


You can easily create an interactive heatmap in R using plotly:

library(plotly)
plot_ly(z = volcano, type = "heatmap")

Heatmap generation

More instructions here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜