B.20 Quick interactive plots with ggplotly

We can make any of these plots interactive using ggplotly. By default, a tooltip is created that shows whatever aesthetics are used inside aes().

Code
library(plotly)
g = ggplot(d, aes(x = ascore, 
                  y = hscore))+
  geom_point()

ggplotly(g)

We’ll discuss this, and plot_ly function more in the main text.