After mylevels <- seq(0,10,10) mylevels has length 2, hence you get 2 colors. Use length=10,
Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Oct 7, 2015 at 3:40 AM, begrinner <j.terhey...@t-online.de> wrote: > Dear R community! > > I haven't worked with R before but I found it has some nice abilities to > create graphics. I made it to create a filled.contour with the settings I > want but unfortunately I don't seem to be able to change colors. Instead of > the standard colors, I'd like to get dark gray or black for higher values > (instead of pink) and light gray or white for lower values (instead of > cyan). A second option I'd like to try is having colors change from green > (low values) to red (high values)... but right now it seems like I'm miles > away from that. > > This is what I have so far: > > model=function(a, b){+4+0.5*a-0.2*b} > x=seq(-10, 10, by = 2) > y=seq(0, 100, by = 10) > z=outer(x, y, model) > contour(x,y,z,nlevels=12) > mylevels <- seq(0,10,10) > filled.contour(x,y,z, main="Title") > > But when I try to Change the Color theme like this - > > > filled.contour(x,y,z,levels=mylevels,col=grey(seq(0,1,length=length(mylevels)))) > > - I just get one white and one black bar. > > Does anyone of you know a solution? > > Thanks in advance, you'd help me a lot as I've been working on these few > lines for a couple already. > > J > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/changing-colors-in-filled-contour-tp4713260.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.