Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Good design is important. Don’t believe me, maybe you’ll like this TED radio hour episode. Good design is especially important in data visualization and data communication. Colors, scales, jitter, figure type are all decisions that need to be considered. Two of my favorite palettes are ggplot2
extensions: ggthemes
and viridis
.
< !--more-->
Each of these packages have additional color palettes that can be used, but these two are my favorite. The gdocs palette from ggthemes
has 20 colors, more than enough for most applications. The default viridis
color is generally used for continuous variables, however it can be used for discrete values if used with discrete = T
argument.
Outside ggplot2
It is possible to use these colors outside the ggplot2
world. Which is great, because the default colors for base R graphics are even more attrocious than ggplot2
. use the following function for each package, gdocs_pal()(n)
and viridis(n)
where n is the number of colors needed.
You can use the same functions to grab colors anytime you need a color palette. Even in leaflet.
Just a quick post about making better figures. The ggthemes
has many more color palettes, all of which can be accessed with x_pal()
where x is the name of the ggtheme. For whimsical color palettes be sure to check out the wesanderson
package, a set of palettes inspired by the films of Wes Anderson. Or the yarrr
package, or learn to create your own.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.