Example_Plotly

Leihong

December 15, 2017

Preparation

In this simple slide we want to show the usage of plotly, with embeded dataset mtcars
### load plotly

library(plotly)

Draw a plotly figure

f <- list(
  family = "Courier New, monospace",
  size = 18,
  color = "#FF00FF"
)
x <- list(title = "HP", titlefont=f)
y <- list(title = "MPG", titlefont=f)

Final Figure

plot_ly(x=mtcars$hp, y=mtcars$mpg, color = as.factor(mtcars$cyl),) %>% layout(xaxis=x,yaxis=y)