From the course: R: Interactive Visualizations with htmlwidgets

Unlock the full course today

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

Make ggplot2 interactive using Plotly

Make ggplot2 interactive using Plotly - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

Make ggplot2 interactive using Plotly

- [Narrator] Plotly has the ability to automatically convert a wide range of ggplot2 charts into interactive plotly charts with almost no effort at all. Let's look at how we can go about doing that in our studio. Inside of our exercise files we have a file called GG plot two conversion dot R. Let's open that up okay. At the top of the script file we can see we load the library tidyverse. Let's run that with command enter, and the tidyverse library simply loads the most frequently used libraries from the tidyverse ecosystem. Then on line three, I use the function load, to load the dot R data set, which is called British weather. Then, line five through 18, I use dplyr and then ggplot2 to build up a static chart. Lets run this code with command enter to see how it looks. So I have a nice, attractive looking static ggplot2 output here. I can see I have a scatter plot, with straight lines joining my markers, my X axis is labeled month, my Y axis is labeled mean daily temperature…

Contents