Data visualization of the R language-drawing color of R

Source: Internet
Author: User
Tags rcolorbrewer

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.