Black Lives Matter. Please consider donating to Black Girls Code today.

Why the data argument for plots has to be a list and can't be a single element

Calls to, for intance, iplot need the first argument, data to be a “list of traces”. However, often you just want to pass one trace and in this case the plot is not shown, wouldn’t be convenient to accept as well data being a single trace argument as well as a list? or at least convert single traces to a list with length 1, like this data=[trace], but do it behind the scenes, transparently to the user.

I expect this behaviour to be more intuitive and closer to how the plot function of R works.

Hi @Abeserra, this sounds like a fine suggestion. Feel free to open a feature request issue at https://github.com/plotly/plotly.py.

-Jon

1 Like

OK, here we go: https://github.com/plotly/plotly.py/issues/1373