Day 6 Harvard cs50 & R language lattice plotting with three color package

day 5, the most listened to cs50 week 0 of the lesson, very enlightening and interesting. Most impressed by the teacher to explain the meaning of the algorithm tear address book, and further the lead is a graph comparing the merits of different algorithms.

day6, completed today with the swirl lattice plotting and working with colors two exercises, very rewarding, especially the use of note-taking on some of the package color are as follows:

  1. grDevices — package

There are two main functions: colorRamp and colorRampPalette, both first designated red, green, and blue as a two palette (understood as palette), to form a new function, such as p, then the p is derived input digital result set comprising a plurality of colors. ---- The following example red and blue c ( "red", "blue")

. A colorRamp used in the new function represented by the color number between 0-1, 0, indicates the first bit to full color, the second color-free (e.g., p (0) is output: 255, 0, 0) . The end result will be n output bits for the group of vectors group 3, column three colors are red, green and blue, the number of lines corresponding to the new digital input function. p

b. colorRampPalette hexadecimal, integer input, the output of the corresponding six-digit hexadecimal number on each bit 0-F. 6, each represent a two color, respectively, corresponding to red, green, blue. 6 displays the two-digit output, this group corresponds to an integer number of the new function input. -pp

Cohesion: pp (6) p (seq (0,1, len = 6)) were consistent with

  1. alpha property
    when setting a new function, can add an extra argument: alpha = TRUE / FALSE any number or alpha = / 0, true / arbitrary number is full, completely opaque; false / 0 is not displayed completely transparent.
    The benefits of transparency set: When the dot-intensive, if no transparency is not displayed the degree of difference in point of widespread dense area, but if set transparency will become very clear.
    When the dot-intensive, transparency greatly benefit the readability of map

  2. RColorBrewer Package
    as cols <- brewer.pal (3, " BuGn"), for taking out the following three tables for that particular color, can be extracted for further argument when constructing new function colorRampPalette like.
    The left is a brief description of this packet, wherein the right is three ways store the color corresponding to the arrangement (sequential, divergent, qualitative)

Guess you like

Origin blog.csdn.net/qq_43198462/article/details/83796855