Interactive chart

Could I use R-Markdown to create an interactive chart like the one above?

Sure, you just need to knit(generate) it as html document. Not sure, whether you need exactly the same graph format, but something like r2d3 or plotly, could get you something close enough. Also, you can use ggplotly() function on (almost?) any ggplot object to render it as an interactive chart.

Edit: I realized, that there is also some filtering available in the chart you posted. You need to use crosstalk library for that.

Just as a clarification, you would not be using rmarkdown per se to create the chart, but there are several tools in R (packages) that would allow you to get a similar chart inside and rmarkdown document.

I would be using one of the packages in R, then creating the html document. I just looking so code to get me started.

I am relatively new to R markdown and any assistance is greatly appreciated.


The original chart is made with D3, so you could use r2d3 to replicate it. There are also htmlwidgets such as plotly that could be used to make interactive plots.

Both r2d3 and plotly can be used within R Markdown:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.