Issue with barmode group on Bar Charts

Hi,
New to plotly, I’ve got some troubles with the barmode=‘group’
I have 2couples of 2 traces (one group is +, the other is -) and I would like to group them by 2. With the barmode group they stay as a stack of 4…
Any idea to set the 4 bars on 2 lines instead of 4, to get a yaxis symetry ?
(I would like get down all the left bars of 2 lines)

https://plot.ly/~aut0wash/0/role-vs-gpm-xpm-repartition/#/

team1g = np.array([600, 623, 653, 650, 670])
team2g = np.array([600, 623, 653, 650, 670])
team1p = np.array([-578, -541, -411, -322, -230])
team2p = np.array([-578, -541, -360, -312, -170])

y = ["Carry", "Mid", "Offlane", "Support 4", "Support 5"]

layout = go.Layout(yaxis=go.layout.YAxis(title='Role'),
                   xaxis=go.layout.XAxis(
                       range=[-1200, 1200],
                       tickvals=[-1000, -700, -300, 0, 300, 700, 1000],
                       ticktext=[1000, 700, 300, 0, 300, 700, 1000],
                       title='GPM XPM repartition'),
                   barmode='group',
                   bargap=0.15,
                   bargroupgap=0.1)

data = [go.Bar(y=y,
               x=team1g,
               orientation='h',
               name='Team Liquid GPM',
               hoverinfo='x',
               marker=dict(color='powderblue')
               ),
        go.Bar(y=y,
               x=team2g,
               orientation='h',
               name='Team Secret GPM ',
               hoverinfo='x',
               marker=dict(color='darkgreen')
               ),
        go.Bar(y=y,
               x=team1p,
               orientation='h',
               name='Team Liquid XPM',
               text=-1 * team1p.astype('int'),
               hoverinfo='text',
               marker=dict(color='teal')
               ),
        go.Bar(y=y,
               x=team2p,
               orientation='h',
               name='Team Secret XPM',
               text=-1 * team2p.astype('int'),
               hoverinfo='text',
               marker=dict(color='seagreen')
               )]

py.iplot(dict(data=data, layout=layout), filename='gg')

Thx u for reading, hope I expressed good enough !

Hi @aut0wash,

Welcome to the forums! If I understand the use-case you’re describing, I don’t think this is possible yet. I think we’ll need the stackgroup property proposal in https://github.com/plotly/plotly.js/issues/3614 to make this possible.

Could you take a look at https://github.com/plotly/plotly.js/issues/3614 and see if it looks like this is what you want?

Thanks,
-Jon

Hi @jmmease !
Thx you for answering !
I checked the github link and it looks like the same, I made a picture to show what I would like to obtain in the end.


You think you will update the code with a new attribute or do you have in mind another solution (another plot type to get this ?)

PS : sorry for the bad colors !

Thanks,
aut0wash

Hi @aut0wash,

Yes, I think the plan is to eventually introduce this new stackgroup attribute in bar traces. But I don’t think anyone has started working on this yet, so I don’t know how soon it will be available.

-Jon