I would like to create a chart that looks similar to this one. However, rather than having the year on the x-axis I want a bar for different grade levels.
Here is the data that I have:
Percentage Standard Exceeded | Percentage Standard Met | Percentage Standard Nearly Met | Percentage Standard Not Met | |
---|---|---|---|---|
Grade | ||||
3 | 21.78 | 25.20 | 21.72 | 31.31 |
4 | 19.62 | 22.56 | 28.05 | 29.77 |
5 | 18.59 | 15.50 | 24.83 | 41.08 |
6 | 16.96 | 15.45 | 25.63 | 41.96 |
7 | 16.44 | 16.10 | 24.55 | 42.91 |
8 | 15.98 | 13.30 | 21.91 | 48.80 |
11 | 11.47 | 15.33 | 21.56 | 51.64 |
13 | 17.19 | 17.56 | 24.02 | 41.23 |
This is what iβve tried and the resulting plot.
fig = go.Figure()
fig.add_trace(go.Bar(name='Percentage Standard Not Met',
x=df.index,
y=df['Percentage Standard Not Met']))
fig.add_trace(go.Bar(name='Percentage Standard Nearly Met',
x=df.index,
y=df['Percentage Standard Nearly Met']))
fig.add_trace(go.Bar(name='Percentage Standard Not Met',
x=df.index,
y=df['Percentage Standard Met']))
fig.add_trace(go.Bar(name='Percentage Standard Exceeded',
x=df.index,
y=df['Percentage Standard Exceeded']))
# Change the bar mode
fig.update_layout(barmode='stack', template='plotly_white', legend=dict(orientation='h', x=0.3))
fig.update_xaxes(type='category')
fig.update_yaxes(range=[0,100], ticksuffix="%", tickvals=[25, 50, 75, 100])
fig.show()
How can I fix this so they are all on the same scale?