[R] Graphing: plot 3rd variable based on color gradient

Jason Pare jay.pare at gmail.com
Thu Aug 14 21:30:18 CEST 2008


Hello,

I am searching for the best method to plot two variables with points
whose output color depends on the size of a third variable. For
example, the darkness of the x-y point would increase incrementally
based on the size of the z value, similar to the colramp parameter in
geneplotter. This would be analagous to symbols(), except changing the
selection from the color gradient rather than the size of the plotted
shape. The closest I have come so far is the levelplot() function, as
below:

graphdata <- alldata[,c("x","y", "size")]
levelplot(size ~ x * y, data=graphdata)

However, since I only have 147 total observations, the graph produced
by levelplot() is mostly white space. Is there either a function that
would produce this in a more visually digestible form, or a parameter
I can use with levelplot to accomplish this?

Thanks very much

Jason



More information about the R-help mailing list