- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the different color palettes we have in RColorBrewer package?
The different color palettes can be found by using display.brewer.all() function. Each of the palette has different colors. There are three types of palettes defined with names equential, diverging, and qualitative. They are defined for specific uses as written below −
- Sequential palettes are suited to ordered data that progress from low to high.
- Diverging palettes put equal emphasis on mid-range critical values and extremes at both ends of the data range.
- Qualitative palettes are best suited to representing nominal or categorical data.
Find the color palettes in RColorBrewer package
Installing and Loading RColorBrewer package and finding the different color palettes −
install.packages("RColorBrewer") library(RColorBrewer) display.brewer.all()
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
Output
We can view an individual color palette by using its name.
Let’s view first palette in Sequential category −
library(RColorBrewer) display.brewer.pal(n=9,name="YlOrRd")
Output
We can view an individual color palette by using its name.
Let’s view first palette in Diverging category −
library(RColorBrewer) display.brewer.pal(n=12,name="Set3")
Output
We can view an individual color palette by using its name.
Let’s view first palette in Qualitative category −
library(RColorBrewer) display.brewer.pal(n=11,name="Spectral")
Output
We can also view hexadecimal color specification of an individual color palette
Let’s view first palette in Sequential category −
library(RColorBrewer) brewer.pal(n=9,name="YlOrRd")
Output
[1] "#FFFFCC" "#FFEDA0" "#FED976" "#FEB24C" "#FD8D3C" "#FC4E2A" "#E31A1C" [8] "#BD0026" "#800026"
We can also view hexadecimal color specification of an individual color palette
Let’s view first palette in Diverging category −
brewer.pal(n=12,name="Set3")
Output
[1] "#8DD3C7" "#FFFFB3" "#BEBADA" "#FB8072" "#80B1D3" "#FDB462" "#B3DE69" [8] "#FCCDE5" "#D9D9D9" "#BC80BD" "#CCEBC5" "#FFED6F"
We can also view hexadecimal color specification of an individual color palette
Let’s view first palette in Qualitative category −
brewer.pal(n=11,name="Spectral")
Output
[1] "#9E0142" "#D53E4F" "#F46D43" "#FDAE61" "#FEE08B" "#FFFFBF" "#E6F598" [8] "#ABDDA4" "#66C2A5" "#3288BD" "#5E4FA2"