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.

Create interactive stacked bar charts

Create interactive stacked bar charts - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

Create interactive stacked bar charts

- [Instructor] Bar charts are excellent visualization options for comparing variables across multiple categories. For instance, how many movies are there in each genre on Netflix? If you have sub-categorized data, for instance, within comedies you have romantic comedies, and horror comedies, then stacked bar charts may be what you want. Plotly makes it very easy to build these charts. Let's see how. In our exercise files, we have a file called bar, dash, charts, dot, r. Let's open it up and see what we have here. I'll open this file, I'll minimize the environment because I don't need it for this exercise. Now at the top of our script file, we load the tidyverse library with a function library. If I run this code with command, enter, we can see on the console that each of the main libraries from the tidyverse has been loaded. This includes readr library, which provides us with the read, underscore, csv function that we use on line three, to read in data from the csv file and assign it…

Contents