We often need more than one color to represent various elements in graphs. Palettes are combinations of colors, which is a convenient way to use multiple colors without choosing individual colors separately. R provides inbuilt color palettes as well as the ability to create our own custom palettes. Using palettes is a good way to avoid repeatedly choosing or setting colors in multiple locations, which can be a source of error and confusion. This helps in separating the presentation settings of a graph from the construction.
All you need to try out in this recipe is to run R and type the recipe in the command prompt. You can also choose to save the recipe as a script so that you can use it again later on. One new library needs to be installed, which is also explained.