- library needed
library(plotly) library(ggplot2)
- get data
data("mtcars")
09/02/2020
library(plotly) library(ggplot2)
data("mtcars")
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")
)