Interactive Plotly demo
This slide contains an interactive Plotly scatter plot.
Try hover, zoom, and the modebar.
Nice interactive bar chart to show grouping.
library(plotly)
avg_hp <- mtcars %>%
mutate(cyl = factor(cyl)) %>%
group_by(cyl) %>%
summarise(avg_hp = mean(hp), n = n())
plot_ly(avg_hp, x = ~cyl, y = ~avg_hp, type = "bar", text = ~paste0("n=", n)) %>%
layout(title = "Average Horsepower by Cylinder Count",
xaxis = list(title = "Cylinders"),
yaxis = list(title = "Avg HP"))How I made this
R + RStudio (or rmarkdown::render()).
revealjs output so it is a presentation (slides).
Plotly is used for interactive plots.
Hosting tips
See the next slide for hosting steps.