How to set value range of heatmap plotted with R?
1
2
Entering edit mode
7.8 years ago
o.tutar ▴ 20

Hello,

I have fold expression change data for three species and I want to plot a heatmap in R ggplot2 package. To compare them I want to set the range fixed for all, for example -5 to 5. Here is my script to plot

heatmap.2( pos_matrix, col = greenred(70),cexRow = 1, cexCol = 1)

If you make a suggestion I will be appreciated.

heatmap R • 37k views
ADD COMMENT
0
Entering edit mode

I'd recommend checking stackoverflow.

ADD REPLY
1
Entering edit mode
7.8 years ago
igor 13k

Check the "breaks" parameter.

Here is a detailed explanation: http://stackoverflow.com/questions/17820143/how-to-change-heatmap-2-color-range-in-r

ADD COMMENT
0
Entering edit mode

Thank you I saw this page however did not help. The program sets the range automatically to -3 :3 because of the max values and when I use this script and change values to see the problem , I still can't set the value between -5:5. But I will write to this website too, thank you for your reply.

ADD REPLY
0
Entering edit mode

This why you use "breaks" to override the automatic behavior.

breaks=seq(-5, 5, length.out=101)
ADD REPLY

Login before adding your answer.

Traffic: 1489 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6