library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
line_0 <- rnorm(200, mean = 8)
line_1 <- rnorm(200, mean = 0)
line_2 <- rnorm(200, mean = -10)
x <- c(1:100)
data <- data.frame(x, line_0, line_1, line_2)
p <- plot_ly(data, x = ~x, y = ~line_0, name = 'line 0', type = 'scatter', mode = 'markers') %>%
add_trace(y = ~line_1, name = 'line 1', mode = 'markers') %>%
add_trace(y = ~line_2, name = 'line 2', mode = 'markers')
p