jeff6868
2012-Dec-12 12:00 UTC
[R] create a color palette with custom ranges between colors
Hello everybody, I'm trying to create my own color palette on R, in order to interpolate some different temperature data on different maps (daily means, seasonal means,...). I would like to create a color palette which works for each map, so I need a color palette between -40 and +40?C. Sometimes my data for one map range from -10 to +20, sometimes from 10 to 30, etc... but always between -40 and +40?C. I would like a fluent color gradation between my extremas (-40 and +40), with different colors between customed values. For example, if the temperature is under -20?C I would like the color "darkblue", then if the temperature is between -20 and 0?C I would like the color "lightblue", then between 0 and 20?C the color "yellow" and finally over 20?C the color "red". Is it possible to create a fluent gradation color palette with customed colors (not just one color for each part, but something fluent based on the chosen colors) ? Something like this: http://i.stack.imgur.com/5NoJh.jpg I would like then to join this customed color palette to all my "levelplot" or "image.plot" functions,in order to create all my maps. Any help for doing this would be very much appreciated! Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/create-a-color-palette-with-custom-ranges-between-colors-tp4652875.html Sent from the R help mailing list archive at Nabble.com.
Pascal Oettli
2012-Dec-12 13:09 UTC
[R] create a color palette with custom ranges between colors
Hello Package 'RColorBrewer' + function 'colorRampPalette' or ?two.colors HTH Pascal Le 12/12/12 21:00, jeff6868 a ?crit :> Hello everybody, > > I'm trying to create my own color palette on R, in order to interpolate some > different temperature data on different maps (daily means, seasonal > means,...). > > I would like to create a color palette which works for each map, so I need a > color palette between -40 and +40?C. Sometimes my data for one map range > from -10 to +20, sometimes from 10 to 30, etc... but always between -40 and > +40?C. > > I would like a fluent color gradation between my extremas (-40 and +40), > with different colors between customed values. > > For example, if the temperature is under -20?C I would like the color > "darkblue", then if the temperature is between -20 and 0?C I would like the > color "lightblue", then between 0 and 20?C the color "yellow" and finally > over 20?C the color "red". > > Is it possible to create a fluent gradation color palette with customed > colors (not just one color for each part, but something fluent based on the > chosen colors) ? > Something like this: http://i.stack.imgur.com/5NoJh.jpg > > I would like then to join this customed color palette to all my "levelplot" > or "image.plot" functions,in order to create all my maps. > > Any help for doing this would be very much appreciated! > > Thanks a lot! > > > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/create-a-color-palette-with-custom-ranges-between-colors-tp4652875.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Nicole K.S. Barker
2012-Dec-12 13:11 UTC
[R] create a color palette with custom ranges between colors
Would this accomplish what you're trying to do? http://www.r-bloggers.com/define-intermediate-color-steps-for-colorramppalette/ Or some combination of ?colorRampPalette and ?cut or classIntervals() from package classInt. On Wed, Dec 12, 2012 at 7:00 AM, jeff6868 <geoffrey_klein@etu.u-bourgogne.fr> wrote:> Hello everybody, > > I'm trying to create my own color palette on R, in order to interpolate > some > different temperature data on different maps (daily means, seasonal > means,...). > > I would like to create a color palette which works for each map, so I need > a > color palette between -40 and +40°C. Sometimes my data for one map range > from -10 to +20, sometimes from 10 to 30, etc... but always between -40 and > +40°C. > > I would like a fluent color gradation between my extremas (-40 and +40), > with different colors between customed values. > > For example, if the temperature is under -20°C I would like the color > "darkblue", then if the temperature is between -20 and 0°C I would like the > color "lightblue", then between 0 and 20°C the color "yellow" and finally > over 20°C the color "red". > > Is it possible to create a fluent gradation color palette with customed > colors (not just one color for each part, but something fluent based on the > chosen colors) ? > Something like this: http://i.stack.imgur.com/5NoJh.jpg > > I would like then to join this customed color palette to all my "levelplot" > or "image.plot" functions,in order to create all my maps. > > Any help for doing this would be very much appreciated! > > Thanks a lot! > > > > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/create-a-color-palette-with-custom-ranges-between-colors-tp4652875.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Nicole K.S. Barker Ph.D Student / Étudiante au Doctorat, Université Laval Faculté de foresterie, de géographie et de géomatique 2405, rue de la Terrasse, bureau 2107, Québec (QC), G1V 0A6 Tél. 418-656-2131 ext 6110 Ducks Unlimited Canada / Canards Illimités Canada 710 Bouvier, bureau 260, Québec (QC), G2J 1C2 Tél. (418) 623-1650 ext 37; Fax (418) 623-0420 [[alternative HTML version deleted]]
jeff6868
2012-Dec-13 09:15 UTC
[R] create a color palette with custom ranges between colors
Thank you Nicole! I did it with the "color.palette" function in the link you gave me. I added then in my levelplot function a sequence with "at": at=seq(-40,40,1) And it works quite good. Thanks again Nicole. Merci ? toi aussi pascal, et vive le CRC ainsi que le grand C..... C..... ! ;) -- View this message in context: http://r.789695.n4.nabble.com/create-a-color-palette-with-custom-ranges-between-colors-tp4652875p4652969.html Sent from the R help mailing list archive at Nabble.com.