[R-sig-Geo] setting breaks in colorramps

Tim Appelhans tim.appelhans at gmail.com
Fri Nov 25 14:08:42 CET 2011


Dear Pep,
see
http://www.r-bloggers.com/define-intermediate-color-steps-for-colorramppalette/
Maybe that is what you're after.

Regards,
Tim

On 25/11/2011 14:03, PepET wrote:
> Dear subscribes,
>
> I have been looking but could not find the exact answer for my question,
> which may seem really from a newbie....
>
> I have several rasters and I want to plot them using a color gradient / ramp
> going from red to grey untill 0 and from grey to green from 0 onwards.
>
> I have managed to create a ramp:
>
> #piba is a raster
>
> myramp<-colorRampPalette( c("red", "white","green"), space="rgb",
> breaks=c(cellStats (piba,min),0,cellStats (piba,max)))
>
> but the problem there is that I want negative cells to go from red to white
> and positive cells from white to green. Using this ramp I do not enshure
> that. I also used breaks option in the plot, but then the display is a
> single color.
>
> Any help? THANK YOU!
>
> Pep
>
>
>
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/setting-breaks-in-colorramps-tp7031046p7031046.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
#####################################
Tim Appelhans
Department of Geography
Environmental Computer Sciences
Philipps Universität Marburg
Deutschhausstraße 12
35032 Marburg (Paketpost: 35037 Marburg)
Germany

Tel +49 (0) 6421 28-25957



More information about the R-sig-Geo mailing list