I am trying to generate multiple plots without having to create a plot for each line. I’m using the subplot function and following the example from this page.
The structure of my data is as follows:
The data is stored in a tibble. The timestamp columns is a POSIXct object, vessel is chr, reading is dbl, and id is int.
Here’s the code I’m using to create the plot:
test_plot <- plot_ly(testData, x = ~timestamp, y = ~reading, color = ~vessel, colors = "Dark2", yaxis = ~paste0("y", id)) test_plot <- test_plot %>% add_lines() test_plot <- test_plot %>% subplot(nrows = 6, shareX = TRUE)
When I run this, I get the following error message:
I’ve tried turning the timestamp into a Date class using as.Date() and turning the tibble into a data.frame so it matches the structure described in the example I linked at the beginning. Lastly, if I exclude the subplot line, I get a single plot with all the lines plotted on it.