Hi all,
Iβm trying to build a stacked bar chart and I want each bar to have its own sorting.
My X-axis is months of a year, my Y-axis is the percentage. Each month has several categories (which are different languages) with different percentages. In one month, Russian might be higher and in another, English. So I need to sort the languages based on that specific month.
Here is a simplified version of the code:
import plotly.express as px
total = total.sort_values(['Month', 'country', 'percentage']).reset_index(drop=True)
# Create the facet grid bar chart
fig = px.bar(total, x='Month', y='percentage_comp', color='Grouped Language',
facet_col='country', facet_col_wrap=2,
title='', text='percentage', labels={'percentage': 'Percentage'},
color_discrete_sequence=px.colors.qualitative.T10)
# Show the plot
fig.show()
Here is what I have right now:
Iβd very much appreciate any comment.