Question: How to set value range of heatmap plotted with R?
2
gravatar for o.tutar
3.2 years ago by
o.tutar20
o.tutar20 wrote:

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 • 16k views
ADD COMMENTlink modified 3.2 years ago by igor8.1k • written 3.2 years ago by o.tutar20

I'd recommend checking stackoverflow.

ADD REPLYlink written 3.2 years ago by RamRS23k
1
gravatar for igor
3.2 years ago by
igor8.1k
United States
igor8.1k wrote:

Check the "breaks" parameter.

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

ADD COMMENTlink modified 3.2 years ago • written 3.2 years ago by igor8.1k

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 REPLYlink written 3.2 years ago by o.tutar20

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

breaks=seq(-5, 5, length.out=101)
ADD REPLYlink written 3.2 years ago by igor8.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1846 users visited in the last hour