Mixed subplots that each have multiple traces?

I am currently trying to plot a bar chart next to a line chart, but my issue is that the examples in the Plotly Javascript for subplots are all simple plots, with a 1:1 trace to subplot ratio. My issue is that I need multiple traces on one line plot, then right next to it I need a grouped bar chart. This seems impossible to do right now, since there is no way to “divide” our traces into their respective subplots.

Am I missing something or can this simply not be done?

Yes, you can provide the yaxis and xaxis parameters to any 2d cartesian trace (i.e. scatter, bar etc) to position them in any arrangement you like on subplots. Here’s a contrived example: https://codepen.io/nicolaskruchten/pen/VweyrYO?editors=0010

1 Like