Color Palettes in R
Author: Michel Alves dos Santos
[[www.michelalves.com :: http://www.lcg.ufrj.br/Members/malves/ ]]
#------------------------------------------------------------------------------#
# Color Palettes.
# Date : 20 February, 2...
JetColorPalette <- colorRampPalette(jet.colors.palette)(my.palette.nc)
# Red Orange Blue Palette
RedOrangeBluePalette <- r...
The End.
Michel Alves dos Santos
Color Palettes in R
The surface used for display of the examples
is the representation of...
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Color Palettes in R
Upcoming SlideShare
Loading in...5
×

Color Palettes in R

393

Published on

[My Gallery of Graphs] Mastering the art of building classic and stylish graphics in R: Color Palettes in R. This document constains some examples of color palettes that can be used in R graphs.

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
393
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Color Palettes in R

  1. 1. Color Palettes in R Author: Michel Alves dos Santos [[www.michelalves.com :: http://www.lcg.ufrj.br/Members/malves/ ]]
  2. 2. #------------------------------------------------------------------------------# # Color Palettes. # Date : 20 February, 2012 # Author : Michel Alves dos Santos #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Loading required libraries #------------------------------------------------------------------------------# require(RColorBrewer) #------------------------------------------------------------------------------# # Color Settings #------------------------------------------------------------------------------# my.palette.nc <- 255 # number of colors my.palette.rc <- 1:205 # range of colors #------------------------------------------------------------------------------- # Color Palettes - Definition of names and component colors #------------------------------------------------------------------------------- # Matlab falshy jet color jet.colors.palette <- c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000") # Pastel palette my.pastel.palette <- rev(c("#62739F", "#8DABBD", "#AB9EB0", "#FFF0A7", "#F4BAA4")) # Sequential RColorBrewer: for more information type display.brewer.all() or display.brewer.all(type="seq") # The sequential palettes names are: Blues BuGn BuPu GnBu Greens Greys Oranges OrRd PuBu PuBuGn PuRd # Purples RdPu Reds YlGn YlGnBu YlOrBr YlOrRd. All the sequential palettes are available in variations from 3 # different values up to 9 different values. YlGnBuPalette <- brewer.pal(9, "YlGnBu") YlOrBrPalette <- brewer.pal(9, "YlOrBr") YlOrRdPalette <- brewer.pal(9, "YlOrRd") # Divergent RColorBrewer: type display.brewer.all(type="div"). The diverging palettes are: BrBG PiYG PRGn # PuOr RdBu RdGy RdYlBu RdYlGn Spectral. All the diverging palettes are available in variations from 3 # different values up to 11 different values. SpectralPalette <- brewer.pal(11, "Spectral") RdYlGnPalette <- brewer.pal(11, "RdYlGn") RdYlBuPalette <- brewer.pal(11, "RdYlBu") # Qualitative RColorBrewer: type display.brewer.all(type="qual"). For qualitative palettes, the lowest # number of distinct values available always is 3, but the largest number is different for different palettes. # It is given together with the palette names in the following table: Accent 8 Dark2 8 Paired 12 Pastel1 9 # Pastel2 8 Set1 9 Set2 8 Set3 12 Pastel1Palette <- brewer.pal(9, "Pastel1") Pastel2Palette <- brewer.pal(8, "Pastel2") #------------------------------------------------------------------------------# # Deifinition of Palettes with number of color equal to: my.palette.nc #------------------------------------------------------------------------------# # Palette using rainbow palette RainbowPalette <- colorRampPalette(rev(rainbow(300)[my.palette.rc]))(my.palette.nc) RainbowPaletteV2 <- colorRampPalette((rainbow(300)[my.palette.rc]))(my.palette.nc) RainbowPaletteV3 <- colorRampPalette(rev(rainbow(600)[my.palette.rc]))(my.palette.nc) RainbowPaletteV4 <- colorRampPalette((rainbow(600)[my.palette.rc]))(my.palette.nc) RainbowPaletteV5 <- colorRampPalette(rev(rainbow(800)[my.palette.rc]))(my.palette.nc) RainbowPaletteV6 <- colorRampPalette((rainbow(800)[my.palette.rc]))(my.palette.nc) # Red Blue Palette RedBluePalette <- colorRampPalette(c("red", "white", "blue"))(my.palette.nc) # Red Blue Palette with lab space RedBlueLabPalette <- colorRampPalette(c("red", "white", "blue"), space = "Lab")(my.palette.nc) # Blue Orange palette BlueOrangePalette <- colorRampPalette(c("blue", "cyan", "green", "yellow", "orange", "red"))(my.palette.nc) # Heat Color palette HeatPalette <- rev( heat.colors(my.palette.nc, alpha = .75) ) # Terrain Color Palette TerrainPalette <- rev( terrain.colors(2*my.palette.nc, alpha = .75) ) # Rainbow Green to Red Palette GreenToRedPalette <- rev( rainbow(5*my.palette.nc, alpha = .55)[0: 400] ) # Rainbow Green to Red Palette version 2 GreenToRedPaletteV2 <- c( rainbow(my.palette.nc, start = 0, end = 0.4) ) # Topo Color Palette TopoPalette <- rev( topo.colors(10*my.palette.nc, alpha = .50)[0:840] ) # Cm Color Palette CmPalette <- cm.colors(5*my.palette.nc, alpha = 1) # Matlab jetcolor palette JetColorPalette <- colorRampPalette(jet.colors.palette)(my.palette.nc)
  3. 3. JetColorPalette <- colorRampPalette(jet.colors.palette)(my.palette.nc) # Red Orange Blue Palette RedOrangeBluePalette <- rev(colorRampPalette(c("red", "orange", "blue"), space = "Lab")(my.palette.nc)) # My Pastel Palette MyPastelOrangeBluePalette <- (colorRampPalette(my.pastel.palette)(my.palette.nc)) # My Color Brewer Palettes MyColorBrewerYlGnBuPalette <- colorRampPalette(YlGnBuPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerYlOrBrPalette <- colorRampPalette(YlOrBrPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerYlOrRdPalette <- colorRampPalette(YlOrRdPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerSpectralPalette <- rev(colorRampPalette(SpectralPalette, interpolate = "spline")(my.palette.nc)) MyColorBrewerSpectralPaletteV2 <- colorRampPalette(SpectralPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerRdYlGnPalette <- colorRampPalette(RdYlGnPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerRdYlBuPalette <- colorRampPalette(RdYlBuPalette, interpolate = "spline")(my.palette.nc) MyColorBrewerPastel1Palette <- colorRampPalette(Pastel1Palette, interpolate = "spline")(my.palette.nc) MyColorBrewerPastel2Palette <- colorRampPalette(Pastel2Palette, interpolate = "spline")(my.palette.nc) #------------------------------------------------------------------------------# # Harmonized palettes. For more combinations access: http://design-seeds.com/, # www.colourlovers.com/browse, www.color-hex.com/color-palettes/, # www.colorcombos.com #------------------------------------------------------------------------------# RedBlueRedPalette <- colorRampPalette(c("red", "blue", "darkred"), interpolate = "spline")(my.palette.nc) DarkBlueToBlackPalette <- colorRampPalette(c("darkblue", "red", "orange", "black"), interpolate = "spline") (my.palette.nc) YellowToBlackPalette <- colorRampPalette(rev(c("#191919", "#DFE2DB", "#FFF056", "#FFFFFF")), interpolate = "spline")(my.palette.nc) GreenToOrangePalette <- colorRampPalette((c("#585858", "#118C4E", "#C1E1A6", "#FF9009")), interpolate = "spline") (my.palette.nc) OrangeToDarkGreyPalette <- colorRampPalette(rev(c("#404040", "#6DBDD6", "#B71427", "#FFE658")), interpolate = "spline")(my.palette.nc) GrayOrangeGreenPalette <- colorRampPalette(rev(c("#558C89", "#74AFAD", "#D9853B", "#ECECEA")), interpolate = "spline")(my.palette.nc) GreenLemonPalette <- colorRampPalette(rev(c("#005A31", "#A8CD1B", "#CBE32D", "#F3FAB6")), interpolate = "spline")(my.palette.nc) OrangeToCyanPalette <- colorRampPalette(rev(c("#A7DBD8", "#E0E4CC", "#F38630", "#FA6900")), interpolate = "spline")(my.palette.nc) BluePurpleWinePalette <- colorRampPalette(rev(c("#F7F5EB", "#EFD7D7", "#E6B8C2", "#B594B2", "#8470A1")), interpolate = "spline")(my.palette.nc) BrownCoffeePalette <- colorRampPalette(rev(c("#E2AA79", "#BE7554", "#9B5730", "#823A21", "#5E3B25")), interpolate = "spline")(my.palette.nc) WaterLightBluePalette <- colorRampPalette((c("#5DBCD2", "#D9E6F6", "#7288C4", "#CFCFE7", "#F2E0F0")), interpolate = "spline")(my.palette.nc) TerraCotaBluePalette <- colorRampPalette((c("#E96D63", "#7FCA9F", "#85C1F5", '#4A789C', '#FCFEFD')), interpolate = "spline")(my.palette.nc) LightOrangeBluePalette <- colorRampPalette((c("#f7ecb2", "#c4d67a", "#3cb074", '#43cfc3', '#aaf0cd')), interpolate = "spline")(my.palette.nc) SandBrownBluePalette <- colorRampPalette((c("#ebe7e2", "#e3dbcf", "#d9c3a1", '#968f81', '#67a7db', '#c1dbeb')), interpolate = "spline")(my.palette.nc) SummerSunsetPalette <- colorRampPalette(rev(c('#b4bede', '#bf9bc7', '#5c4a80', '#5e485a', '#ffb891', '#fff7bd')), interpolate = "spline")(my.palette.nc) GradientBluePalette <- colorRampPalette((c('#ddecf6', '#99c6e5', '#56a1d5', '#33607f', '#19303f')), interpolate = "spline")(my.palette.nc) SwirlingRainbowPalette <- colorRampPalette(rev(c('#dfe3e2', '#97e7e8', '#3e8fd1', '#21596e', '#f7aaa6', '#e9f065')), interpolate = "spline")(my.palette.nc) BlackberryHuePalette <- colorRampPalette((c('#f6fab9', '#e3b571', '#5e2a3d', '#452c44', '#a3629c', '#b096ab')), interpolate = "spline")(my.palette.nc) HangingBluesPalette <- colorRampPalette((c('#f1d5f5', '#f6a8f7', '#c469e0', '#8f53b0', '#613d87', '#8763bd')), interpolate = "spline")(my.palette.nc) AquaLightBluePalette <- colorRampPalette((c("#ebdbd9", "#7db3a8", "#3d839c", "#57a7b5", "#73c1c7", "#a9d2de")), interpolate = "spline")(my.palette.nc) DesertCactusPalette <- colorRampPalette(rev(c("#ede1c0", "#97bd8c", "#738a7c", "#695f6b", "#de9a88", "#f5ccb8")), interpolate = "spline")(my.palette.nc) BonFireHuesPalette <- colorRampPalette(rev(c("#f2e9d9", "#dbc6b2", "#99786d", "#61564f", "#e0774e", "#f5d4a1")), interpolate = "spline")(my.palette.nc) PeacockPlumePalette <- colorRampPalette((c("#f2eee9", "#b8a2a0", "#61393e", "#e35349", "#91aacc", "#ededbe")), interpolate = "spline")(my.palette.nc) CrystalAquaPalette <- colorRampPalette(rev(c("#96ccd9", "#9cd1d6", "#ace0d8", "#c8d9d6", "#e6ddd6", "#ebebe4")), interpolate = "spline")(my.palette.nc) #------------------------------------------------------------------------------# # Setting the current palette #------------------------------------------------------------------------------# ColorPalette.MyChosenPalette <- MyPastelOrangeBluePalette
  4. 4. The End. Michel Alves dos Santos Color Palettes in R The surface used for display of the examples is the representation of high-pass Gaussian filter in the frequency domain.

×