Plotly examples

Here are just a couple of example of what you can do with Plotly.

library(plotly)
set.seed(1)

d <- diamonds[sample(nrow(diamonds), 1000), ]

plot_ly(d, x = ~carat, y = ~price, color = ~carat,
        size = ~carat, text = ~paste("Clarity: ", clarity))

Converting ggplot chart to plotly using ggplotly

Don’t forget to Click-drag to zoom, shift-click to pan, double-click to autoscale
p <- ggplot(data = d, aes(x = carat, y = price)) +
    geom_point(aes(text = paste("Clarity:", clarity))) +
    geom_smooth(aes(colour = cut, fill = cut)) + facet_wrap(~ cut)

ggplotly(p)