[R] about col in heatmap.2

jim holtman jholtman at gmail.com
Sat Dec 1 02:41:38 CET 2007


I was just using colorRampPalette to generate a range of color.  You might try:

 Lab.palette <- colorRampPalette(c("dark red", "yellow", "dark green"))

to see if this is closer.  You can use the palette in other plot
functions; this was just the easiest to show what was happening.

On Nov 30, 2007 8:34 PM, affy snp <affysnp at gmail.com> wrote:
> Jim,
>
> This is not right as I think. The color code generated did not
> show a grading pattern. For example, it should go from
> very red---red---less red---dark----green---very green coinciding
> with the descending order of values, just like the very left panel
> shown in
> http://www.bme.unc.edu/research/Bioinformatics.FunctionalGenomics.html
> You got my point. But the case you gave is not the case I think.
> Any thoughts on this? Moreover, I still prefer it be done by heatmap
> because I also want the dendrogram.
>
> Best,
>      Allen
>
>
>
>
> On Nov 30, 2007 8:25 PM, jim holtman < jholtman at gmail.com> wrote:
> > Try this.  This will plot a similar scale for data.
> >
> > require(lattice)
> > # generate some data
> > x <- matrix(sample(0:8,100,replace=TRUE),10) # create 9 value
> > # create a color palette for outpu
> > Lab.palette <- colorRampPalette(c("red", 'yellow','green','blue'))
> > levelplot(x,col.regions=Lab.palette(10))
> >
> >
> >
> >
> >
> > On Nov 30, 2007 7:58 PM, affy snp <affysnp at gmail.com> wrote:
> > > Hi Jim,
> > >
> > > Thanks but I imagine the transformed data would
> > > not actually represent the pattern from the original
> > > data. Is there other alternatives? Ideally, I would
> > > like to have the color bar looking like the one
> > > in
> http://www.bme.unc.edu/research/Bioinformatics.FunctionalGenomics.html
> > >
> > > Best,
> > >      Allen
> > >
> > >
> > >
> > > On Nov 30, 2007 7:08 PM, jim holtman <jholtman at gmail.com> wrote:
> > > > If you are just going to have 3 values for coloring, then you could
> > > > just convert your data into 1, 2, 3:
> > > >
> > > > new.data <- ifelse(old.data > 2, 3, ifelse(old.data < 2, 1, 2))
> > > > dim(new.data) <- dim(old.data )
> > > >
> > > > and then plot it.
> > > >
> > > >
> > > >
> > > >
> > > > On Nov 30, 2007 5:09 PM, affy snp <affysnp at gmail.com> wrote:
> > > > > Hi list,
> > > > > My data set is comprised of 47 columns and about 700 rows.
> > > > > Most of the values would be around 2, while some will go beyond
> > > > > in either direction, higher or lower. Is there a way to specify the
> > > > > parameter of col or others if necessary to have the range of
> > > representing
> > > > > colors be 0----8, and make dark for 2, red for higher than 2 and
> green
> > > > > for lower than 2. Is there a way to do this? Thanks a lot for your
> > > > > suggestions.
> > > > >
> > > > > All the best,
> > > > >      Allen
> > > > >
> > > > >        [[alternative HTML version deleted]]
> > > > >
> > > > > ______________________________________________
> > > > > R-help at 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.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Jim Holtman
> > > > Cincinnati, OH
> > > > +1 513 646 9390
> > > >
> > > > What is the problem you are trying to solve?
> > > >
> > >
> > >
> >
> >
> >
> > --
> >
> >
> >
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem you are trying to solve?
> >
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list