Make a bar chart with values like this

Hi,
How can I make a bar chart like this?:

image

With this data:

Food A B
Pizza 9,3 % 11,4 %
Hamburger 8,1 % 9,2 %
Pasta 7,6 % 12,0 %
Ice 12,2 % 13,0 %

Hi @anne12,

what did you try so far? Maybe this helps:

import pandas as pd
import plotly.graph_objs as go
df = pd.read_excel('Book2.xlsx')

fig = go.Figure()
fig.add_trace(go.Bar(name='A', x=df['Food'], y=df['A']*100, marker_color='#003E69'))
fig.add_trace(go.Bar(name='B', x=df['Food'], y=df['B']*100, marker_color='#A5A5A5'))
fig.add_hline(y=10, line_dash="dot", line_color='red')
# Change the bar mode
fig.update_layout(barmode='stack', 
                  template='plotly_white', 
                  legend=dict(orientation='h', x=0.3), 
                  title={
                      'text': "Food",
                      'y':0.9,
                      'x':0.5,
                      'xanchor': 'center',
                      'yanchor': 'top'})
fig.update_xaxes(type='category')
fig.update_yaxes(ticksuffix="%")
fig.show()

You can set barmode = 'stack' to make this type of chart.