0
0
R Programmingprogramming~5 mins

Color scales and palettes in R Programming - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a color palette in R?
A color palette in R is a set of colors used together to make plots or graphics look nice and clear. It helps to keep colors consistent and visually appealing.
Click to reveal answer
beginner
How do you create a simple color palette using base R?
You can create a simple color palette using the palette() function, for example: palette(c("red", "green", "blue")) sets the palette to red, green, and blue.
Click to reveal answer
intermediate
What is the purpose of the colorRampPalette() function?
colorRampPalette() creates a function that generates a smooth gradient of colors between given colors. You can use it to make many colors blending from one to another.
Click to reveal answer
beginner
Name two popular R packages for advanced color palettes.
Two popular R packages for color palettes are RColorBrewer and viridis. They provide many ready-to-use palettes for different purposes.
Click to reveal answer
intermediate
What is the difference between sequential and diverging color scales?
Sequential color scales show a progression from light to dark or low to high values, good for ordered data. Diverging scales have two contrasting colors meeting in the middle, useful for showing deviation from a midpoint.
Click to reveal answer
Which function in base R creates a smooth gradient of colors?
Apalette()
BcolorRampPalette()
Ccolors()
DcolorGradient()
Which package provides the brewer.pal() function for palettes?
ARColorBrewer
Bscales
Cggplot2
Dviridis
What type of data is best visualized with a diverging color scale?
AData with a meaningful midpoint
BRandom data
CCategorical data
DBinary data
Which function sets the current color palette in base R?
AsetPalette()
BcolorRamp()
Ccolors()
Dpalette()
The viridis package is known for palettes that are:
ARandom colors
BOnly black and white
CColorblind-friendly and perceptually uniform
DOnly pastel colors
Explain how to create and use a custom color palette in R using base functions.
Think about how you tell R which colors to use and then use them in a plot.
You got /3 concepts.
    Describe the difference between sequential and diverging color scales and when to use each.
    Consider how colors change and what the data represents.
    You got /3 concepts.