From the course: R: Interactive Visualizations with htmlwidgets

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Specify your own colors

Specify your own colors - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

Specify your own colors

- [Instructor] There's a certain knack or trick to customizing the colors used in a high charter chart. Let's look at a quick example in our exercise files. Let's open bar chat custom colors. At the top of the script file, we load three libraries that we need: first, the tidyverse library, which we run with Command + Enter, then the highcharter library as these are the charts we're going to create. Now, every time we load the highcharter library we get a message reminding us Highcharts is not free for commercial or governmental use. On Line 3, we'll also load the RColorBrewer library as this gives us access to a very nice color scheme called paired that we're going to use to color our bar charts. On Line 5, we read in a CSV file using read underscore csv and then I'm going to decrease the size of our environment because I don't need it. Lines 8 through 32 used a mutate verb to add two new columns to our data frame. The first is country group color where we map each of the country…

Contents