Plotly how to hide error messages

Every time I use Plotly, I get an error. The graph comes out normally, but an error message comes out and the console gets messy. How can you erase the error message?

No trace type specified:
  Based on info supplied, a 'bar' trace seems appropriate.
  Read more about this trace type -> https://plotly.com/r/reference/#bar
Warning: Ignoring 28 observations

No trace type specified:

You could supply a trace type.

Providing a trace type will result in a new error message. But the plot is normal. So I want to know how to remove it.

Can you provide a reproducible example?

example :
df 1
X1 : {100, 200, 300}
X2 : {'2010', '2011', '2012'}
df 2
X1 : {200, 300, 100}
X2 : {'2010', '2011', '2012'}

 plot_ly() %>%
            add_trace(x = df$X1, y = df$X2, name= input$mn) %>%
            add_trace(x = df2$X1, y = df2$X2, name= input$mn2) %>%
            layout(
                legend = list(x = 0, y = 1.5),
                title = "Yearly Data"
            )

thank u

what error would you get if you add_bars instead of add_trace. (because even though you havent said it one way or the other, the implication is that you want a bar chart)

No error here:

library(tidyverse)
library(plotly)

df <- tibble(X1 = c(100, 200, 300),
              X2 = c('2010', '2011', '2012'))

df2 <- tibble(X1 = c(200, 300, 100),
              X2 = c('2010', '2011', '2012'))

plot_ly() %>%
  add_trace(x = df$X1, y = df$X2, type = "bar", name = "test") %>%
  add_trace(x = df2$X1, y = df2$X2, type = "bar", name = "test2") %>%
  layout(
    legend = list(x = 0, y = 1.5),
    title = "Yearly Data"
  )

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.