Skip to content
R for the Rest of Us Logo

How to make interactive graphs in R

David Keyes David Keyes
March 8th, 2021

I recently got a question about making interactive graphs in R. Sara Kidd of the Hampton Roads Planning District Commission asked me the following:

I am wondering what is the easiest/most efficient way to create interactive graphs and then embed them into a web page. While I will have a need for static graphs in reports, I will likely need to put some up on the website as well and I have been asked how to make them interactive (hover over with pop-ups, etc.). Thanks!

The good news for Sara is that it is very possible to make interactive graphs in R. And the even better news is that you can make graphs as you always would, using ggplot, and then make some small adjustments to make them interactive.

In last week's R for the Rest of Us office hours session, we discussed two packages for making interactive graphs: ggiraph and plotly (here's a blog post that walks through the process of using it to make graphs interactive).

In addition to showing how to make the graphs interactive, I demonstrated how you could connect your GitHub account to Netlify in order to publish interactive graphs that you could then embed on another website.

I hope this is helpful in showing how to make interactive graphs in R!

Let us know what you think by adding a comment below.

You need to be signed-in to comment on this post. Login.