Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread baptiste auguie
A minimum code to plot a coloured matrix with text labels could be the following: library(grid) library(scales) library(RColorBrewer) diverging_palette <- function(d = NULL, centered = FALSE, midpoint = 0, colors = brewer.pal(7,"PRGn")){ half <- length(colors)/2

Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread jim holtman
Check out the XLConnect package for formatting a spreadsheet. On Tue, Feb 14, 2012 at 5:21 PM, John Nicholas wrote: > All, > > I frequently make spreadsheets in Excel in which I rank values in columns > by stop-light colors (red is bad, yellow is OK, green is good). > > Image and heatmap expect a

Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread Kenneth Frost
Hi, John- Sorry if my last email was not clear.  In R I imagine you having two matrices. One with the raw values and one with values scaled or standardized by column. The matrix with the values scaled by column is used to make the heatmap (i.e. color the image) and the matrix with the raw values

Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread Kenneth Frost
Hi, John- Would it be possible to scale the values in each column to fall between 0 and 1 (or standardize them) and use a single color ramp? Ken On 02/14/12, John Nicholas wrote: > All, > > I frequently make spreadsheets in Excel in which I rank values in columns > by stop-light colors (red is

[R] Color cells of a matrix as in Excel

2012-02-14 Thread John Nicholas
All, I frequently make spreadsheets in Excel in which I rank values in columns by stop-light colors (red is bad, yellow is OK, green is good). Image and heatmap expect a matrix in which all the data are in the same scale, but I frequently have different scales in different columns. ie. Column one