How to create interactive charts/graphs and embed

  • How to create interactive charts/graphs and embed

    Posted by Sara on February 19, 2021 at 6:30 am

    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!

    David Keyes replied 1 year, 7 months ago 3 Members · 4 Replies
  • 4 Replies
  • David Keyes

    February 19, 2021 at 12:56 pm

    Great question, Sara! This is something I’d love to cover in the next office hours session. What’s your timing on this? If you’re ok to wait until the next session (March 5), we can do that.

    In the meantime, the two packages I’d suggest checking out are ggiraph and plotly (here’s a blog post that walks through the process of using it to make graphs interactive).

  • Sara

    February 22, 2021 at 6:23 am

    That would be great. I’m not in a big rush on this, just doing some research. I’ll try to make it to the office hour. Thanks!

  • Paul McElroy

    March 5, 2021 at 8:22 am

    Hi guys, good topic! I also have an interest in this. Less so for embedding on a website, but the need for interactivity on graphs that would be distributed from RMarkdown for example. I have looked into Shiny, but the cost of hosting on RStudio Connect (rather than using as it would be confidential information) will probably prove too much.

    So sending reports with plots more likely. If the RMarkdown script produced a html page output, can this contain interactivity for the users that receive it, given that they will be end users with no access to the data or R.



  • David Keyes

    March 5, 2021 at 4:01 pm

    Good question, Paul! Yes, you can send HTML documents that you create with RMarkdown and users will get the interactivity embedded within them. That is, if the interactivity is basic (e.g. hovering over a point to see a popup tooltip that explains what it is). Shiny is required for more complex things like rebuilding plots based on user-filtered data.

    We talked about this in office hours today. Here’s the recording!