Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(tidyverse)
- library(plotly)
- library(datasets)
- data(airquality)
- # add months
- airquality$Month <- factor(airquality$Month,
- labels = c("May", "Jun", "Jul", "Aug", "Sep"))
- # add sample names
- airquality$Sample <- paste0('Sample_',seq(1:nrow(airquality)))
- # boxplot
- p <- ggplot(airquality, aes(x = Month, y = Ozone)) +
- geom_boxplot()
- p <- plotly_build(p)
- p
- library(plotly)
- vals <- boxplot(airquality$Ozone,plot = FALSE)
- y <- airquality[airquality$Ozone > vals$stats[5,1] | airquality$Ozone < vals$stats[1,1],]
- plot_ly(airquality,y = ~Ozone,x = ~Month,type = "box") %>%
- add_markers(data = y, text = y$Day)
Add Comment
Please, Sign In to add comment