Interactive Figures with R and plot_ly

Daniel Liden


In this post, we attempt to embed an interactive plot generated using plot_ly in this web page. The plot was generated in R. We are following this guide to embed the interactive figure.

Some context: the figure below depicts the change in enrollment in health insurance through the marketplace (the federal marketplace established through the Affordable Care Act) from coverage year 2019 to coverage year 2020. A static version of this figure was made using ggplot. The figure is part of a blog post I wrote for the Guinn Center for Policy Priorities, where I am currently working as director of data and analytics. This experiment with interactive figures was born out of an interest to introuce more compelling visual storytelling into our blogs, reports, and other materials. My Guinn Center blog post on the topic of health insurance enrollment for coverage year 2020 can be found here.

Here is the figure:

Some of the features of this figure include:

This is just the start of what is possible with plot_ly and with interactive figures in general. Keep an eye out here and on the Guinn Center blog for more!