This works. The original example was trying to do something with the yaxis, but I think this needs to be done in layout(). The subplots command does not automatically create the subplots, if you read the documentation for it. You have to put the plots in a list then send the list to subplot()
library(plotly)
testData <- data.frame(
timestamp = sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"), 100, replace = TRUE),
vessel = sample(LETTERS[1:4], 100, replace = TRUE),
reading = floor(runif(100)*60-10),
id = sample(1:4, 100, replace = TRUE))
test_plot <- plot_ly(testData,
x = ~timestamp,
y = ~reading,
color = ~vessel,
colors = "Dark2")
test_plot <- test_plot %>% add_lines()
test_plot <- test_plot %>% subplot(nrows = 1, shareX = TRUE)
test_plot