Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Group bar charts as subplots

Hello,
I want to create a set of subplots where each subplot is grouped bar chart. For example, each of the bar charts I want to add will look something like this:

cub_trace = go.Bar(
    x=[config],
    y=[config[0]],
    name='cub'
)
libpp_trace = go.Bar(
    x=[config],
    y=[config[1]],
    name='libpp'
)
data = [cub_trace, libpp_trace]
all_data.append(data)
layout = go.layout(barmode='group')

Now the problem is grouped bar charts are represented by a pair of a data list and a layout object. While subplots, afaik, only allow appending traces, for example:

fig.append_trace(box_1, 1, 1)
fig.append_trace(box_2, 1, 2)
fig.append_trace(heatmap, 2, 1)

So how can I make a subplot that contains bar charts as subplots?

I am new to plotly and I tried to find way around this but couldn’t. Any help would be much appreciated.

Thanks

Hey there…i had the same question and saw you got the answer on stackoverflow. I’m just following up with a link to that answer here since this page comes up higher in the SERP.

https://stackoverflow.com/questions/37033581/adding-group-bar-charts-as-subplots-in-plotly