Subplots using Plotly - Failing to Coerce List to Double

I am trying to create a plot using the subplot function in Plotly. I am following the examples as described here. The code I have written so far:

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)

But I get the following error:

Error Traceback

Here's the structure of my data:

+---------------------+-----------+---------+-----+
|      timestamp      |  vessel   | reading | id  |
+---------------------+-----------+---------+-----+
| 2019-01-02 09:00:00 | pre_ac_1  | 54      | 5   |
| 2019-01-02 09:00:00 | post_ac_1 | 58      | 3   |
| 2019-01-02 09:00:00 | ac_dif_1  | -4      | 1   |
| 2019-01-02 09:00:00 | pre_ac_2  | 52      | 6   |
| 2019-01-02 09:00:00 | post_ac_2 | 50      | 4   |
| 2019-01-02 09:00:00 | ac_dif_2  | 2       | 2   |
| 2019-01-03 09:00:00 | pre_ac_1  | 56      | 5   |
| 2019-01-03 09:00:00 | post_ac_1 | 60      | 3   |
| ...                 | ...       | ...     | ... |
+---------------------+-----------+---------+-----+

I'm completely lost on why I'm getting this error. I can copy and paste the example from the Plotly website and it works fine, but for some reason when I use my data it fails.

Additionally, I've tried turning the timestamp into a Date class using as.Date() and turning the tibble into a data.frame so it matches what is described in the example but that doesn't seem to be what's causing the issue. Also when I skip the subplot line, it creates a single plot with multiple lines on it.

It would be helpful to have full access to testData, not just a preview of it. Please use something like readr::write_csv() to save a csv file and link to it (or feel free to email it to me)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

I sent you an email. I'm hesitant to post that info publicly even though I've scrubbed it of all identifying info.