5. Color of the R language drawing
· Grdevice Bag
-Colorramp () and Colorramppalette ()
-color names can be obtained using colors ()
· Rcolorbrewer Bag
-Three types of palettes:
1. Sequential: From an extreme gradient to another extreme, suitable for rendering sequential data
2. Diverging: Bright at both ends and lighter in the middle, suitable to highlight the extreme values, that is, to emphasize the choice of high and low contrast
3. Qualitative: color contrast between colors, suitable for presenting categorical variables
-Palette information can be used in conjunction with Colorramp/colorramppalette
Pal <-Colorramp (C ("Red", "Blue")) Pal (0) # Redpal (1) # Bluepal (0.5) Pal (seq (0,1,len=10)) # 0 to 1 sequence medium pitch value pal <- Colorramppalette (C ("Red", "yellow")) Pal (1) # Returns the hexadecimal representation of the color of Pal (2) # returns red and Yellowpal (10) # returns 10 colors, with a tail-and-back color of red and yellow, Middle color in both colors Middle Library (rcolorbrewer) Brewer.pal.info # Returns the artboard name, maximum number of colors, palette type, whether to color-blind friendly cols <-brewer.pal (3, "Greens") # Call the Greens palette, take 3 colors, assign a value to Colspal <-Colorramppalette (cols) # assign cols to Colorramppaletteimage (volcano, Col=pal (20)) # DataSet volcano, Color set to: 3 colors for 3 endpoints, between the 3 colors (20 colors in total) Display.brewer.pal (3, "Greens") # shows 3 colors in Greens
Data visualization of the R language-drawing color of R