On Fri, Mar 18, 2011 at 3:37 PM, Frank Schwach <f...@sanger.ac.uk> wrote:
> Hi,
>
> I'm plotting a heatmap with values ranging from -10 to +10 and I would
> like the negative values to show up in shades of blue and the positive
> ones in shadea of red. Basically, I want exactly what the RColorBrewer
> palette RdBu does but with more of a gradual change (the RdBu can only
> give me 11 distinct colours). Any suggestions?

 Use RColorBrewer along with my colourscheme package
[https://r-forge.r-project.org/R/?group_id=435] to interpolate between
them:

library(RColorBrewer)
bp = brewer.pal(11,"RdBu")
library(colourschemes)
cs = rampInterpolate(c(-10,10),bp)

now cs is a function that interpolates the 11 palette colours so you
have a continuous colour palette. Note the interpolation is (umm I
think) linear in R G and B.

s=seq(-10,10,len=100
plot(s,s,col=cs(s),pch=19)

gives you 100 different colours.

Barry

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to