Hi all, I would like to display the percentage of each segment of a bar in a stacked percent bar chart. Is it a way to do it natively, or should I first create an array with the expected values and give it as text
parameter in my traces’ data?
Are you creating the graph from a DataFrame
? If so just pass the column name to the text param - i.e.,
fig = px.bar(df, x='col_x', y='col_y', barmode='stack', color='col_color',
text='col_x', orientation='h')
Thank you. It appears that in plotly.js, this doesn’t give the wanted result. Instead of having the percentage displayed, I get the absolute values as labels.
Check this