09/02/2020

data and library

  • library needed
library(plotly)
library(ggplot2)
  • get data
data("mtcars")

Code for plot

p <- plot_ly(mtcars, x = ~ as.factor(mtcars$cyl),y = mtcars$mpg,color = as.factor(mtcars$cyl) , type = "box") %>%
  layout(
    title = "mpg depending on cyl",
    xaxis = list(title = "cyl"),
    yaxis = list(title = "mpg")
    )

Slide with R Output