the "image" function should do it, something like this: image( x, y, 
outer(x,y,u), col=[some vector of colors] ) You can add a "breaks" parameter 
but you need one more break than you have colors (include the start and end 
point).  Or just let it be automatic.I have used colorpanel() from the gplots 
library to generate graduated color shades.  This is based on actual code I'm 
using for one of my heatmaps: library(gplots) # for colorpanelz <- 
outer(x,y,u)image( x, y, z, colorpanel(10,"steelblue","white"), 
breaks=quantile(z,seq(0,1,by=0.1))  )box() # for appearancespar(new=TRUE)  # 
you want the lines on top of the colors, so do the contour plot 
secondcontour(...) It will produce ten colors with steelblue for the highest 
value and white for the lowest value, and one shade for each decile.  You can 
omit the "breaks" term.  > I have drawn indifference curves using the program 
below (Contour Plot)
> 
> 
> u <- function(x, y) x^0.5 + y^0.5
> x <- seq(0, 1000, by=1)
> y <- seq(0, 1000, by=1)
> a <- c(10, 20, 30)
> contour(x, y, outer(x, y, u),levels=a,col="blue")
> 
> 
> 
> 
> Now can any body please tell me how to draw Heat maps
> 
> and that too on the same indifference curve plot (contour)
> 
                                          
        [[alternative HTML version deleted]]

______________________________________________
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