# Subplot failing in plotly

I am having the exact same issue at this. Subplots using Plotly - Failing to Coerce List to Double

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),
id = sample(1:4,  100, replace = TRUE))

test_plot <- plot_ly(testData,
x = ~timestamp,
color = ~vessel,
colors = "Dark2")
test_plot <- test_plot %>% subplot(nrows = 1, shareX = TRUE)
test_plot``````

Thank you, I have figured it out. The issue was in the nrows argument in the subplot command.It should be
subplot(nrows = length(unique(df.new\$variable)), shareX = TRUE)

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

Thanks for the reply, I am still getting the same error. The timestamps are like this

Is the error due to the presence of milliseconds?

Here is my full code
{"ft_lang_label":"__label__en","ft_lang_prob":0.7400431,"math_prob":0.8987538,"size":1930,"snap":"2020-45-2020-50","text_gpt3_token_len":537,"char_repetition_ratio":0.10903427,"word_repetition_ratio":0.12631579,"special_character_ratio":0.31398964,"punctuation_ratio":0.17847769,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9966081,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-30T15:15:03Z\",\"WARC-Record-ID\":\"<urn:uuid:586dad85-b0b3-400e-adf3-6edbae024a35>\",\"Content-Length\":\"21496\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3517c44b-a3df-4278-9474-a1f5fcbb76a2>\",\"WARC-Concurrent-To\":\"<urn:uuid:21cbb33b-64d7-4459-9de5-a00e1e5426e2>\",\"WARC-IP-Address\":\"167.99.20.217\",\"WARC-Target-URI\":\"https://community.rstudio.com/t/subplot-failing-in-plotly/71025\",\"WARC-Payload-Digest\":\"sha1:TO2QYZF6QIMMLITKTO6PJMHNGP5MBFJW\",\"WARC-Block-Digest\":\"sha1:4UBZEKVUZK3YYOU35BHDG5HYGXODQT3S\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141216175.53_warc_CC-MAIN-20201130130840-20201130160840-00615.warc.gz\"}"}