Hi Dmitri,

On Mon, May 21, 2012 at 5:06 PM, Dimitri Liakhovitski
<dimitri.liakhovit...@gmail.com> wrote:
> I was wondering if someone could point in the direction of a package
> that could generate not heatmaps, but something like a unidimensional
> heat map.
> I might be mistaken, but it seems like image and heatmap are an
> overkill for such a simple task.

You don't have to use all the options. Why not use something like
image that does the heavy lifting for you?

> For example, if I have a data frame:
> x<-data.frame(myname=paste("value",1:10,sep=""),a=1:10,b=sample(1:10,10,replace=T))
>
> I'd like to create a chart (it's more of a table, actually) with one
> horizontal axis ("myname") and 2 rows of rectangles above it - one for
> "a" and one for "b". Such that the higher the value, the more intense
> the color of the rectangle (10 rectangles for 10 values).

Here's one approach:


image(as.matrix(x[,2:3]), xaxt="n", yaxt="n")
axis(1, seq(0, 1, length=10), x[,1])
axis(2, c(0, 1), colnames(x)[2:3])

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
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