![]() If a color is mapped to a variable with two groups, the colors for those groups will come from opposite sides of the color wheel, or 180 degrees apart (360/2 = 180). It turns out ggplot automatically generates discrete colors by automatically picking evenly spaced hues around something called the hcl color wheel. They’re not simply “red”, “green” and “blue”. ![]() Now what if there’s a color palette in ggplot that we would like to use in base R graphics? How can we figure out what those colors are? For example, let’s say we like ggplot’s red, green, and blue colors it used in the first plot above. Scale_color_gradient(low = "white", high = "red") Ggplot(iris, aes(x=Sepal.Length, y=Petal.Length, color=Sepal.Width)) +
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |