Hi, I have a matrix with both positive and negative numbers, I would like to use image() to draw a heatmap. How can I can design a palette (or is there a function already available) that treat negative numbers in a blue gradient and positive numbers in a red gradient and treat 0 as white? Thanks
On Wed, 3 Aug 2005, array chip wrote:> Hi, I have a matrix with both positive and negative > numbers, I would like to use image() to draw a > heatmap. How can I can design a palette (or is there a > function already available) that treat negative > numbers in a blue gradient and positive numbers in a > red gradient and treat 0 as white? >?colorRampPalette -thomas
'Tim.colors' in 'fields' package goes from blue to red, and passes through the colors cyan, yellow, and orange. Also known as Jet color-map in Matlab. You can also easily design your own color map using 'rgb' function from 'gdDevices'. Jarek ====================================================\====== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ Jaroslaw.W.Tuszynski at saic.com ` \ -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of array chip Sent: Wednesday, August 03, 2005 8:03 PM To: r-help at stat.math.ethz.ch Subject: [R] color palette Hi, I have a matrix with both positive and negative numbers, I would like to use image() to draw a heatmap. How can I can design a palette (or is there a function already available) that treat negative numbers in a blue gradient and positive numbers in a red gradient and treat 0 as white? Thanks ______________________________________________ R-help at stat.math.ethz.ch mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! R-project.org/posting-guide.html