# Is there any way to update one specific trace's layout?

**URL:** <https://community.plotly.com/t/is-there-any-way-to-update-one-specific-traces-layout/39680>\
**Category:** Dash Python\
**Created:** [May 18, 2020, 5:27pm UTC](https://community.plotly.com/t/is-there-any-way-to-update-one-specific-traces-layout/39680 "2020-05-18T17:27:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juanouo](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Juanouo](https://community.plotly.com/u/Juanouo)\
**Post date:** [May 18, 2020, 5:27pm UTC](https://community.plotly.com/t/is-there-any-way-to-update-one-specific-traces-layout/39680/1 "2020-05-18T17:27:45Z")

</div>

Hey all,  
I had what I thought was a very simple problem but it has sent me through a rabbit hole and I guess I’m missing something. I was trying to make a very simple 2x1 plot. The first plot was a stacked bar plot, and the second one is a regular bar plot with a scatter, like this:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/4/4abbcfe7adef537625d85bdf9fc36538de7faed6.png)

In this case it isn’t really a problem, but if I wanted to use two different barmodes for my subplots, what could I do? Because `barmode` is linked to the figure’s `layout` I can’t seem to find a way to plot two types of `barmodes` in different subplots.

My code goes something like this:

```auto
    trace1 = go.Bar(x=dfv['date'], y=dfv['used'],
                         marker_color='red')
    trace2 = go.Bar(x=dfv.fecha, y=dfv.disponible
                     marker_color='green')
    fig.append_trace(trace1, 1, 1)
    fig.append_trace(trace2, 1, 1)

    trace3 = go.Bar(x=dfv.date, y=dfv.total, name='Total ')
    trace4 = go.Scatter(x=dfv['date'], y=dfv['percentage'], name='% ')
    fig.append_trace(trace3, 2, 1)
    fig.append_trace(trace4, 2, 1)
    fig.update_layout(barmode='stack')

```

Si if `trace4` was also a bar and I wanted non-stacked bars for this one, what could I do?  
Thanks

Edit: I saw `px.bar()` has a `barmode` argument, but it has weird interactions with `add_trace()` (or I’m also missing something, so that kinda worked, but the label was lost and I had to updated several properties with `udpate_traces`. I also tried `cufflinks`’ `iplot` but `barmode` was ignored by Dash.

---

<div class="post-metadata">

**Author:** ![Emmanuelle](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emmanuelle/32/7853_2.png) [@Emmanuelle](https://community.plotly.com/u/Emmanuelle)\
**Post date:** [May 19, 2020, 7:22am UTC](https://community.plotly.com/t/is-there-any-way-to-update-one-specific-traces-layout/39680/2 "2020-05-19T07:22:28Z")

</div>

Hi @Juanouo you are right, the barmode is a layout attribute so it is not possible to have different barmodes in different subplots :-(. You would have to go with several figures (two `dcc.Graph` in a Dash app), each of them with its layout and corresponding attributes.

---

<div class="post-metadata">

**Author:** ![Juanouo](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Juanouo](https://community.plotly.com/u/Juanouo)\
**Post date:** [May 22, 2020, 4:18pm UTC](https://community.plotly.com/t/is-there-any-way-to-update-one-specific-traces-layout/39680/3 "2020-05-22T16:18:09Z")

</div>

Thanks for the answer @Emmanuelle. Isn’t it a bit weird that barmode is a layout property? Seems more like a figure property to me. Do you know what’s the logic to that?
