Hi,

 

I'm trying to create a "heatmap" that is just a line segment.  That is,
a graphic that shows an interval and how a dependent variable varies
along that interval, with the value of the dependent variable shown by
color rather than on a y-axis.  

 

The image() function produces something close to what I'm envisioning,
but rather than plotting color on a 2-D grid, I need a line where the
color carries the information about the other dimension.  The following
example code gives a visual approximation of what I'm going for (using
image(), but by shrinking the y-axis down to make the result line-like):

 

x <- c(1:100)

y <- abs(40-x)

 

my.col <- heat.colors(10)

par(pin=c(par("pin")[1],.05))

image(x, 1, as.matrix(y), ylim=c(1,1), col=my.col, xaxt="n",xlab="",
yaxt="n", ylab="", fg="transparent")

 

 

I will be generating several of these "heatlines" to plot on a 2-D grid,
which will contain other information on it as well, and so also need to
be able to add the lines to an existing plot.

 

I've read the doc for stripplot(), contour(), image(), and checked the R
Graph Gallery (http://addictedtor.free.fr/graphiques/) to try to find
something similar, but haven't figured out the best way to do this,  I
envision a function similar to segments(), where you can specify where
the line should be drawn, the line width (lwd), and other graphical
parameters, but where you can specify a vector of color values.  

 

Is there a package that has such functionality already, and if not, what
would be most elegant way to approach it?  If it matters, I'm running R
2.9.1 on XP 32-bit.

 

Thanks for any suggestions.

 

--

Keith 

 

 

 

--

Keith Woolner

Manager, Baseball Research & Analysis

Cleveland Indians

216-420-4625

kwoolner@indians.com

 


	[[alternative HTML version deleted]]


