# Different colours for each facet row in px.bar - how to do it? \[Solved\]

**URL:** <https://community.plotly.com/t/different-colours-for-each-facet-row-in-px-bar-how-to-do-it-solved/59274>\
**Category:** 📊 Plotly Python\
**Created:** [December 14, 2021, 1:23pm UTC](https://community.plotly.com/t/different-colours-for-each-facet-row-in-px-bar-how-to-do-it-solved/59274 "2021-12-14T13:23:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![broekeman](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@broekeman](https://community.plotly.com/u/broekeman)\
**Post date:** [December 14, 2021, 1:23pm UTC](https://community.plotly.com/t/different-colours-for-each-facet-row-in-px-bar-how-to-do-it-solved/59274/1 "2021-12-14T13:23:21Z")

</div>

![grafiek_export](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/2/6/2667bbfec38dace4a8344fa8b07cf96a463ad1fe.png)

Hello everyone,

Plotly newbie here. I am trying to create a barplot in which the column facets all have different colours. So far I have succeeded by putting the different categories in the “color” option in px.bar as well as the “facet\_col” option. The problem with this is that the plotted bars aren’t aligned, but on different heights. If that doesn’t make any sense, please check the attached file with the barplot I am talking about.

I would like to have all three subplots in different colours AND at the same height. Could anyone please help me with this?

Greetings,  
Harm

This is the code I am using:

`cheng_grafiek=px.bar(cheng.sort_values(by=["Bron","Score"]),y="LAP naam",
                     x="Score",
                     color="Bron",
                     title="Vergelijking scores uit Cheng et al. (2019) en de risico-analyse afval",
                     barmode="group", 
                     orientation="h",
                     height=900,
                     facet_col="Bron",
                     #color_discrete_sequence=["blue","magenta","green"],
                     facet_col_spacing=0,
                     category_orders={"Bron": ["Cheng et al. (2019)", "Risico analyse (export)", "Risico analyse (import)"]})`

---

<div class="post-metadata">

**Author:** ![broekeman](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@broekeman](https://community.plotly.com/u/broekeman)\
**Post date:** [December 15, 2021, 9:17am UTC](https://community.plotly.com/t/different-colours-for-each-facet-row-in-px-bar-how-to-do-it-solved/59274/2 "2021-12-15T09:17:54Z")

</div>

Alright, it was a simple solution. Boy, do I feel like an idiot… All I had to do was change “barmode” to “stack”.  
😑

Don’t tell anyone, okay???
